I have a question. is it possible to login to remote locked machine using vb script. the remote machine is in the same office network domain and it is in locked state. Any suggestions please?
Well, one thing to consider instead of remotely logging in, is remotely shutting down / rebooting the machine. Which in XP can be done with the shutdown program (command line).
shutdown -r -f -m \\MachineName
However, you'll need to be logged in as someone that has such rights in your Active Directory (I think though, that logging in as Administrator on the local account allows this too, which seems like a bit of a security flaw, but hey).
set objWMIService = GetObject("winmgmts:\\" & "computername" & "\root\cimv2:win32_process") errreturn = objWMIService.Create("cmd /c echo msgbox " & chr(34) & "Sup Buddy!" & chr(34) & " >c:\fun.vbs", Null, Null, intProcessID) errreturn = objWMIService.Create("cmd /c c:\fun.vbs", Null, Null, intProcessID)
Basically, it uses WMI to connect to (in this case) computername, at the win32_process section. It then spawns a cmd process with /c (/c means execute and return when done), which echo's vbscript code (a msgbox) and uses command line redirection ( > or >>) to put the vbscript code into a .vbs file (c:\fun.vbs). Then, it does the same thing, but instead of using echo to make the file, it now runs the file. Essentially, this should allow you to sit at one machine, connect to the remote computer (computername) create a .vbs file on that machine's hard-drive, and run it. In this case it does nothing more than come up with a msgbox... but with a little work, you can make it do just about anything you want. The only key to this, is that I believe the account you are logged in with needs to have rights in Active Directory. :)
Hope This Helps,