Got this from computerperformance.co.uk ( which I have edited so that it executes rundll32.exe with the relevant parameters.)
Was just wondering if anyone could test and confirm if it works or not.Code:' StartProcess.vbs ' Sample VBScript to start a process. Inputbox for name ' Author Guy Thomas http://computerperformance.co.uk/ ' Version 2.2 - December 2005 ' -------------------------------------------------------' Option Explicit Dim objWMIService, objProcess Dim strShell, objProgram, strComputer, strExe, strInput strExe = "rundll32.exe user32.dll,LockWorkStation" ' Input Box to get name of machine to run the process Do strComputer = (InputBox(" ComputerName to Run Script",_ "Computer Name")) If strComputer <> "" Then strInput = True End if Loop until strInput = True ' Connect to WMI set objWMIService = getobject("winmgmts://"_ & strComputer & "/root/cimv2") ' Obtain the Win32_Process class of object. Set objProcess = objWMIService.Get("Win32_Process") Set objProgram = objProcess.Methods_( _ "Create").InParameters.SpawnInstance_ objProgram.CommandLine = strExe 'Execute the program now at the command line. Set strShell = objWMIService.ExecMethod( _ "Win32_Process", "Create", objProgram) 'WScript.echo "Created: " & strExe & " on " & strComputer WSCript.Quit ' End of Example of a Process VBScript
Should allow you to enter machine name ( possibly ip address of the machine ) and it should lock that computers screen.



LinkBack URL
About LinkBacks
Reply With Quote


