Help - Search - Members - Calendar
Full Version: Activate Screensaver & Lock Workstation
MSFN Forums > Customizing Windows and Graphics > Windows Tips 'n' Tweaks

   
Google Internet Forums Unattended CD/DVD Guide
jeffsu28
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...
oioldman
You can do this, i did, but found that i couldn't get the station to unlock so removed the reg keys.
I used regsnap to note reg changes, but recall them being in HKCU\control panel\desktop
Rhino
Gotta check out RegSnap...
blackbull
[edit] Didnt work
maxXPsoft
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. woot.gif
CODE
[HKEY_CURRENT_USER\Control Panel\Desktop]
"ScreenSaverIsSecure"="1"

BTW it depends on timeout for the screensaver to start when its sitting there.
maxXPsoft
You could set your screensaver timeout to 1 minute. But that would mess with you severely laugh.gif
jdbrisel
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"
davidhoff
QUOTE (jdbrisel @ Oct 11 2006, 07:36 PM) *
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!
bflmpsvz
QUOTE (davidhoff @ Sep 28 2007, 04:25 PM) *
QUOTE (jdbrisel @ Oct 11 2006, 07:36 PM) *
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 mad.gif .
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.gif
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.gif thumbup.gif
Again, it does not block the computer to go to Stand-by.
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.