Thursday, February 9, 2012

Locking a Machine in a OCS Desktop Sharing/SCCM Remote Tools Session

With the many tools available now, there are many means for the support staff to access into a user's machine to render assistance. OCS desktop sharing as well as SCCM Tools is one of that is being used my my current organization.

These tools however come with a challenge. How will the support staff be able to maintain the security of the machine when the support case ends as they are not to logoff from the machine.

For this I have come up with a simple vbs that will enable the support staff to lock the screen remotely from their machine (Provided RPC connectivity is operational)

strcomputer = InputBox("Please enter computer name:", "Machine Name to Lock")

strCommand = "cmd.exe /k %windir%\System32\rundll32.exe user32.dll, LockWorkStation"

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objProcess = objWMIService.Get("Win32_Process")


errReturn = objProcess.Create(strCommand, null, null, intProcessID)

If errReturn = 0 Then
Wscript.Echo "**" & ucase(strcomputer) & " has been locked successfully**!"
End If

Just copy the code in grey as above and save it as a vbs file.

Alternatively if it is preferred to lock the machine locally, the below  can be run either at command prompt or run window

%windir%\System32\rundll32.exe user32.dll, LockWorkStation

No comments:

Post a Comment