Jump to content

Activate Screensaver & Lock Workstation


jeffsu28

Recommended Posts

Is there any way via vbscript or batch file or even editing the registry to have the screensaver run and also lock the computer when I initiate it. I tried creating a shortcut to the screensaver but that just runs the screensaver and the computer is not locked. I created a shortcut that uses the rundll32 user32,LockWorkStation but that only locks the computer. I am for 1 thing that can do both. Any ideas? Thanks...

Link to comment
Share on other sites


If you have "On Resume Password Protect" enabled and just hit the Windows key and L

Simplest thing I found. It instantly goes to logon screen so whatever you had running ius hidden if you need quickness. :w00t:

[HKEY_CURRENT_USER\Control Panel\Desktop]
"ScreenSaverIsSecure"="1"

BTW it depends on timeout for the screensaver to start when its sitting there.

Edited by maxXPsoft
Link to comment
Share on other sites

  • 1 year later...

Try this vb script:

Set objShell = CreateObject( "Wscript.Shell" )

' The "True" argument will make the script wait for the screensaver to exit

returnVal = objShell.Run( "%windir%\System32\ssmypics.scr" , 1, True)

' Then call the lock functionality

objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"

Edited by jdbrisel
Link to comment
Share on other sites

  • 11 months later...
Try this vb script:

Set objShell = CreateObject( "Wscript.Shell" )

' The "True" argument will make the script wait for the screensaver to exit

returnVal = objShell.Run( "%windir%\System32\ssmypics.scr" , 1, True)

' Then call the lock functionality

objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"

Simply but perfect. Thanks a lot.

PS=Why it's useful? Because I can set my defrag util to start on screensaver...

@D!

Link to comment
Share on other sites

  • 4 months later...
Try this vb script:

Set objShell = CreateObject( "Wscript.Shell" )

........

objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"

Simply but perfect. Thanks a lot.

I do not like this solution, it does not help me. Because if the workstation is "locked" this way, any scheduler trying to set the computer to Stand-by state simply fails (using rundll32 powrprof.dll,SetSuspendState ). The running vb script probably blocks it, so only when one logs in, the computer goes to Stand-by immediatelly :angry: .

Solution I use at last is based on simple application http://www.jsifaq.com/SF/Tips/Tip.aspx?id=0302 . It simply runs screensaver which is set in Display Properties - Screen saver , but it could be done from ordinary .bat file. Batch file ends and you have the same situation, as if you locked workstation and waited for set time. So my batch looks like this:

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

"C:\util\savescrn.exe"

Now I can run it, comp is immediatelly locked with running screensaver. Lately, scheduler runs VLC, records some on-line multicast session and sets the comp to Stand-by or Hibernate (or Turn off). I am fully satisfied. :thumbup

11.4.2008:

And, because screensaver does not save LCD panels too much, I use this batch:

c:\util\nircmd.exe monitor off

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

See http://www.nirsoft.net/utils/nircmd2.html - handy small command line utility. :thumbup:thumbup

Again, it does not block the computer to go to Stand-by.

Edited by bflmpsvz
Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...