Monday 7 October 2013

Code to Restart and Shutdown the System in QTP

strComputer = "dscp xxxxx“         ' Mention machine name / IP address
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colOperatingSystems
    objOperatingSystem.Reboot()
//objOperatingSystem.Win32Shutdown(1)    ‘ “1” is for Shut Down -->for shudowning

Next

No comments:

Post a Comment