Forum Discussion

dbriggs's avatar
dbriggs
New Contributor
11 years ago

Network Variable not updating on Slave

So this might be a better place to put this issue. I created a user form to get the IP Address of a computer so that I can use TestExecute to set the TrustedHost permission on slave computers. BUt the Network Variable WILL NOT update :/. Anyone have any thoughts?










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]");


 


}



 


 

No RepliesBe the first to reply