Forum Discussion

Radar's avatar
Radar
Occasional Contributor
13 years ago

Time Sync Machine inside VM Environement

We have a testing environment which comprises a number of VM's that represent our production system.

TestComplete resides on its own XP VM in this environment, however is part of a Workgroup and is not on the Domain with the VM's that make up the system.



What I am trying to do is ensure the TC VM is time synchronised with the Comms VM and I do this each time the project suite is executed.  I amtrying to achieve this by doing the following:



[JScript]


     

    var commsServerName = "\\\\AMICOMMS01"; 

    var cmdString = "net time "+commsServerName+" /set /y";

    var processID = WMI.CreateProcess(cmdString);

    

I have not success in synchronising the TC VM with the Comms VM using the snippet above.

I do however have success when from the TC VM command line or Run line use "net time \\AMICOMMS01 /set /y"



Do you have any suggestion/s?



Regards

Mark


2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Try creating an instance of the WScript.Shell object and using the Exec method to run the command line.



    var commsServerName = "\\\\AMICOMMS01";  

    var cmdString = "net time "+commsServerName+" /set /y"; 

    var ShellObj = Sys.OleObject("WScript.Shell")

    ShellObj.Exec(cmdString)
  • Radar's avatar
    Radar
    Occasional Contributor
    Hello Robert 



    Thank you for the advice, it works.



    Regards

    Mark