Kaseya Community

Variable input scripts

This question is not answered

Hey all,

 

 

I have am building a script to do remote installs of network printers, IE:

User calles the service desk and wants a printer installed on her PC, we then select the installprinter script and fires it on the users agent.

 

the script has a collection process that grabs all advertized UNC paths to all printers on the network and then populates this into a variable that gets returned to the scripting engine, and prompts the Service desk admin to input the UNC path to the printer to be installed, all good and well,   erm NOT,

 the variable IE:#MyVar#

is shown as #MyVar# instead of \\Server\Printer1, \\Server\Printer2 ........   

Does anyone know how to get arround this?

 

Regards,

All Replies
  • to see why it is showing #MyVar# instead of \\Server\Printer1, \\Server\Printer2 I would need to look at your procedure code, sounds a bit odd though

    I think this is were managed variables would be good to use, it will mean that you will need to update this predefined variable every time they add or remove printers but it also means you could have a single script that uses the Managed Variable, which can be different for each machine group making it dynamic.

    Something else to look at is the Microsoft Print Migrator  www.microsoft.com/.../printmigrator3.1.mspx

    With this you can backup the printer drivers and settings into a deployable file that you can host off the file server and deploy via an Agent Procedure.

  • The Variable is displayed in the input descriptor field, this is where it is interpreted as RAW text instead of a variable.

    You can test this yourself by creating a script that has an input variable from the scheduling side:

    **********************START PROCEDURE XML******************************

     <?xml version="1.0" encoding="utf-8" ?>

    - <ScriptExport xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns="www.kaseya.com/.../Scripting">

    - <Procedure name="Install Printer" treePres="3">

    - <Body description="">

    - <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false">

     <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

     <Parameter xsi:type="StringParameter" name="SourceContent" value="<table><tr><td>line 1</td><td>action1</td></tr><tr><td>line 2</td><td>action2</td></tr><tr><td>line 3</td><td>action3</td></tr><tr><td>line 4</td><td>action4</td></tr><tr><td>line 5</td><td>action5</td></tr></table>" />

     <Parameter xsi:type="StringParameter" name="VariableName" value="myvar" />

     </Statement>

    - <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false">

     <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

     <Parameter xsi:type="StringParameter" name="SourceContent" value="#MyVar#" />

     <Parameter xsi:type="StringParameter" name="VariableName" value="inputtest" />

     </Statement>

    - <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false">

     <Parameter xsi:type="EnumParameter" name="VariableType" value="Prompt" />

     <Parameter xsi:type="StringParameter" name="SourceContent" value="#ntemp#" />

     <Parameter xsi:type="StringParameter" name="VariableName" value="test" />

     </Statement>

    - <Statement description="Display a message dialog to the user." name="SendMessage" continueOnFail="false">

     <Parameter xsi:type="StringParameter" name="Message" value="#test# : #InputTest#" />

     <Parameter xsi:type="BooleanParameter" name="Immediate" value="False" />

     </Statement>

     </Body>

     </Procedure>

     </ScriptExport>

    **************************************END PROCEDURE XML****************

  • you will need to edit/ repost your post and re paste the procedure export because it has been reformatted by the form and I can't import it. To post the script you will need to edit your post with the HTML button use the following;

    <code>

    **********************START PROCEDURE XML******************************

    **************************************END PROCEDURE XML****************

    </code>

    and save the HTML edit the two line you put in to show the start and the end will be on the same line put your cursor in the middle and press enter to create a gap so you can past your code between the two lines.