Jump to content
Sign in to follow this  
ModemJunki

Worked in XP, now not working in Windows 7

Recommended Posts

ModemJunki

EDIT:

It's fixed now, and it was a PSExec issue. Must use both -i and -s switched together on the command line.

This little script is used to lock all my local hands-on workstations with a single click. Typically I am logged into one station as one user (my corporate ID) and others as an admin user account (which is used only to admin boxes), but both accounts have admin rights on all boxes.

This started out as one of those "can I do this" things, and I kept it around because it's a quick way to lock both my workstations at once. I'm thinking it's a Windows 7 / psexec issue, but so much knowledge here, and maybe other sysadmins like the quick and dirty idea. I can't be the only person with multiple physical workstaions at my desk.

Code fixed.

#AutoIt3Wrapper_icon=.\Icons\lock.ico
#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.3.0.0
    Author:         ModemJunki
    
    Script Function:
    Lock both workstations

        To do: use an INI file for workstation names, build array, allow for (x) number of workstations
    
#ce ----------------------------------------------------------------------------

;  The basic function is a command line
;  rundll32.exe user32.dll, LockWorkStation

$LocalPC = @ComputerName
FileInstall("psexec.exe", @TempDir & "\")

If $LocalPC = "Workstation1" Then
    $RemoteSys = "Workstation2"
ElseIf $LocalPC = "Workstation2" Then
    $RemoteSys = "Workstation1"
EndIf

ShellExecuteWait(@TempDir & "\psexec.exe", "-i -s -accepteula \\" & $RemoteSys & " rundll32.exe user32.dll, LockWorkStation", @WindowsDir, "", @SW_HIDE)
ShellExecuteWait("rundll32.exe","user32.dll, LockWorkStation",@WindowsDir,"",@SW_HIDE)
Edited by ModemJunki

Share this post


Link to post
Share on other sites
omikron48

UAC issue?

Share this post


Link to post
Share on other sites
ModemJunki

UAC issue?

UAC is off as I'm still setting up the system (you know, fresh install - have to get all of my applications installed). In fact, I will probably leave it off, as I'm in a fairly secure environment and I don't use the system for casual web surfing.

So it was a good thought, but no.

Also the firewall is turned off (my group policies do that). I should double-check that, though. The GPs were written and tested with XP in mind, perhaps the GP for firewall control on 7 has to be different somehow.

Share this post


Link to post
Share on other sites
ModemJunki

bump: Fixed! First post edited.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×