dbriggs
12 years agoNew Contributor
Network Variable not updating on Slave
I update a variable with user data from a form I've created. However, the Slave computer when the task is ran does not update at all. Any body have any ideas on what's wrong?.
function mMain(){
switch(UserForms.UserForm1.ShowModal()){
case mrOk:
NetworkSuite.Variables.IPAddress = Form.cxTextEdit1.Text;
Log.Message(NetworkSuite.Variables.IPAddress);
break;
default:
Log.Error("No IP Entered");
}
NetworkSuite.Jobs.ItemByName("Job1").Tasks.ItemByName("Task1").Run(false);
This is the function that Task1 runs:
function tHost(){
Log.message(NetworkSuite.Variables.IPAddress);
TestedApps.powershell.Run();
if(!Sys.WaitProcess("powershell").Exists){
TestedApps.powershell.Run();
isOpen=false;
delay(1000);}
var psSWnd = Sys.Process("PowerShell").Window("ConsoleWindowClass", "*");
psSWnd.Keys("$curValue = (get-item wsman:\\localhost\\Client\\TrustedHosts).value "+ "[Enter]");
Delay(1000);
psSWnd.Keys("Y"+ "[Enter]");
Delay(1000);
psSWnd.Keys("set-item wsman:\localhost\Client\TrustedHosts -value \"$curValue," +NetworkSuite.Variables.IPAddress + "\""+"[Enter]");
Delay(1000);
psSWnd.Keys("Y"+ "[Enter]");
}
function mMain(){
switch(UserForms.UserForm1.ShowModal()){
case mrOk:
NetworkSuite.Variables.IPAddress = Form.cxTextEdit1.Text;
Log.Message(NetworkSuite.Variables.IPAddress);
break;
default:
Log.Error("No IP Entered");
}
NetworkSuite.Jobs.ItemByName("Job1").Tasks.ItemByName("Task1").Run(false);
This is the function that Task1 runs:
function tHost(){
Log.message(NetworkSuite.Variables.IPAddress);
TestedApps.powershell.Run();
if(!Sys.WaitProcess("powershell").Exists){
TestedApps.powershell.Run();
isOpen=false;
delay(1000);}
var psSWnd = Sys.Process("PowerShell").Window("ConsoleWindowClass", "*");
psSWnd.Keys("$curValue = (get-item wsman:\\localhost\\Client\\TrustedHosts).value "+ "[Enter]");
Delay(1000);
psSWnd.Keys("Y"+ "[Enter]");
Delay(1000);
psSWnd.Keys("set-item wsman:\localhost\Client\TrustedHosts -value \"$curValue," +NetworkSuite.Variables.IPAddress + "\""+"[Enter]");
Delay(1000);
psSWnd.Keys("Y"+ "[Enter]");
}