خرید بک لینک

The request: I was asked to look into changing en masse our screen lock policies here at the main office, which would be easy enough to do if I remote logged on and made adjustments one-by-one. But about half or more of our workstations are off-site and off-domain so for various reasons, I wanted to automate the process.

I figured a batch file pushed out through LogMeIn One2Many on a recurring weekly basis would get any and all units including future units.

From what I've read and cobbled together, editing the registry to change the screensaver and set it to 'secure' so that on resume, the screen locks, is ideal. Unfortunately, I can't make registry edits easily even via a script to new users users other than those currently logged on, so I looked to Active Setup to help me push out the registry editing upon log-on for every user.

It looks like the script that changes the registry settings works (although you may have to restart the PC to see the new screen saver settings populate) but the Active setup portion does not work at all and the registry does not appear to be edited on log-on or restart.

Effectively, what the code below is supposed to do is be run just once on each machine (not that any more than once would be an issue.) The code creates another batchfile that Active setup calls every logon.

If you guys could look at this batch file below, that'd be great, thank you.

            REM Screen Lock Script
            REM John Furman | March 2016
            REM Function:
            REM +Block 1; Creates a folder on device
            REM +Block 2; Writes to a batch file in above folder that will first, 
            REM delete any existing screensaver settings, add on settings of my choice, then deletes the 'version' number
            REM in the HKCU registry. This causes the registry entry in Block 3 to run again at logon.
            REM +Block 3; This block sets Active setup to run at user logon, which will run the batch file, 
            REM and will then run again due to Block 2

            REM Block 1
            Cd C:
            MD C:Windows_ECOP_IT

            REM Block 2

            echo reg delete "HKEY_CURRENT_USERControl PanelDesktop" /v ScreenSaveTimeOut /f >C:Windows_ECOP_IT_ECOP_ScLock.bat      
            echo reg delete "HKEY_CURRENT_USERControl PanelDesktop" /v ScreenSaverIsSecure /f >>C:Windows_ECOP_IT_ECOP_ScLock.bat        
            echo reg delete "HKEY_CURRENT_USERControl PanelDesktop" /v ScreenSaveActive /f >>C:Windows_ECOP_IT_ECOP_ScLock.bat           
            echo reg delete "HKEY_CURRENT_USERControl PanelDesktop" /v SCRNSAVE.EXE /f >>C:Windows_ECOP_IT_ECOP_ScLock.bat               

            echo reg add "HKEY_CURRENT_USERControl PanelDesktop" /v ScreenSaveTimeOut /t REG_SZ /d 600 /f >>C:Windows_ECOP_IT_ECOP_ScLock.bat       
            echo reg add "HKEY_CURRENT_USERControl PanelDesktop" /v ScreenSaverIsSecure /t REG_SZ /d 1  /f >>C:Windows_ECOP_IT_ECOP_ScLock.bat        
            echo reg add "HKEY_CURRENT_USERControl PanelDesktop" /v ScreenSaveActive /t REG_SZ /d 1 /f >>C:Windows_ECOP_IT_ECOP_ScLock.bat           
            echo reg add "HKEY_CURRENT_USERControl PanelDesktop" /v SCRNSAVE.EXE /t REG_SZ /d C:WINDOWSsystem32scsave.scr /f >>C:Windows_ECOP_IT_ECOP_ScLock.bat   

            echo reg add "HKEY_CURRENT_USERSOFTWAREMicrosoftActive SetupInstalled Components_ECOP_ITScSvrLock" /v Version /t REG_SZ /d 1 /f >>C:Windows_ECOP_IT_ECOP_ScLock.bat             
            echo reg add "HKEY_CURRENT_USERSOFTWAREMicrosoftActive SetupInstalled Components_ECOP_ITScSvrLock" /v StubPath /t REG_EXPAND_SZ /d "C:Windows_ECOP_IT_ECOP_ScLock.bat" /f >>C:Windows_ECOP_IT_ECOP_ScLock.bat   
            echo pause >>C:Windows_ECOP_IT_ECOP_ScLock.bat          


            REM Block 3
            reg add "HKEY_LOCAL_MACHINESOFTWAREMicrosoftActive SetupInstalled Components_ECOP_ITScSvrLock" /v StubPath /t REG_EXPAND_SZ /d "C:Windows_ECOP_IT_ECOP_ScLock.bat" /f
            reg add "HKEY_LOCAL_MACHINESOFTWAREMicrosoftActive SetupInstalled Components_ECOP_ITScSvrLock" /v Version /t REG_SZ /d 2 /f

            pause

برچسب: نویسنده: استخدام کار تاريخ: جمعه 28 اسفند 1394 ساعت: 3:52

صفحه بندی