Locking your remote computer

Using simple VB Script you can lock your computer. Following is the code to lock the computer


 On Error Resume Next


Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"


Now the challenge is, how can you use this script to lock the remote computer. This is pretty simple, using VB Script, copy this lock script to a remote computer, then execute the script on remote computer, this will lock the remote computer.



Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "<LockScriptPath>", _
    "\\<Remote_computer_Name>\path_to_copy_file", OverWriteExisting

strComputer = "<Remote_computer_Name>"
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")

Error = objWMIService.Create _
    ("cscript path_to_copy_file", null, null, _
        intProcessID)

In Above code replace:
LockScriptPath: With the local machine path of lock script ( code given above)
Remote_computer_Name : Name or IP address of remote computer to lock.
path_to_copy_file : Path on remote computer where you can copy the lock script. 



     

Comments

Popular posts from this blog

Exception handling with RestTemplate

How to flash CWM Recovery to Samsung Galaxy SL( GT-I9003) using Odin

How to boot Samsung Galaxy SL( GT-I9003) in recovery mode