#105301 - 2003-10-02 12:10 AM
ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Sparko
Fresh Scripter
Registered: 2003-10-01
Posts: 6
|
[Moderator (Sealeopard): Moved thread from 'Scripts' to 'General' forum due to lack of script in body]
I am making a logon script that will force the password-protected screen saver on and remove the Screen Saver tab from desktop properties in Windows 2000. The password-protected screen saver IS being forced on on all systems, but the tab removal is not.
I am finding that in some cases the key
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
does not exist. Attempts to add it with
ADDKEY ("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System")
do not work. I have also tried
WRITEVALUE("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System","NoDispScrSavPage","1","REG_DWORD")
but that doesn't work either. Can anyone tell me what I'm doing wrong here, please? [ 01. October 2003, 23:46: Message edited by: sealeopard ]
|
|
Top
|
|
|
|
#105303 - 2003-10-01 01:51 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Sparko
Fresh Scripter
Registered: 2003-10-01
Posts: 6
|
Thanks. Ummmm, how would I execute this merge?
Also, I've found that my script works fine for users with admin privileges, but not regular users. Is there a way around this?
|
|
Top
|
|
|
|
#105304 - 2003-10-01 01:53 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
quote:
You can create the value by merging a reg file into your registry.
This is true with multiple entries into the registry. However, with only a couple KEYS/VALUES, this is not necessary.
The best practice in this example is to use a GPO. There is a GPO to hide the Screensaver tab as well as a timeout value and screensaver type.
Kent [ 01. October 2003, 13:54: Message edited by: kdyer ]
|
|
Top
|
|
|
|
#105306 - 2003-10-01 02:06 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Why is a merge necessary? From the initial question posed, he clearly states Windows 2000.
If he has a policy in place, this will be a cinch.
If there are no policies in place, it will be pretty easy to add one.
If there is no policy and/or no domain, then add some @ERROR and/or @SERROR checking to see where the script bombs. Really, if that is the case, then maybe posting the real code rather than the pseudocode would be quite helpful.
Kent
|
|
Top
|
|
|
|
#105307 - 2003-10-01 03:00 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Sparko
Fresh Scripter
Registered: 2003-10-01
Posts: 6
|
Very well, here' my entire script, based on one I downloaded from this forum.
$hkcu = 'HKEY_CURRENT_USER' $hkcus = 'HKEY_CURRENT_USER\SOFTWARE' $screensavekey = $hkcu+"\Control Panel\Desktop" $sysini = "%Windir%\System.ini" $poleditkey = $hkcus+"\Microsoft\Windows\CurrentVersion\Policies\System"
if KeyExist( $poleditkey ) <> 0 $screensavetab = Readvalue($poleditkey,"NoDispScrSavPage") if $screensavetab <> 1 WRITEVALUE($poleditkey,"NoDispScrSavPage","1","REG_DWORD") endif else AddKey($poleditkey) WRITEVALUE($poleditkey,"NoDispScrSavPage","1","REG_DWORD") endif
; We have a key, and the tab is hidden. Now change other settings... IF 600 <> Readvalue($screensavekey,"ScreenSaveTimeOut") WRITEVALUE($screensavekey,"ScreenSaveTimeOut","600","REG_SZ") ENDIF
; Turn screen saver on if it isn't already for non BDC London group members IF 1 <> Readvalue($screensavekey,"ScreenSaveActive") WRITEVALUE("HKEY_CURRENT_USER\Control Panel\Desktop","SCRNSAVE.EXE","logon.scr","REG_SZ") WRITEVALUE($screensavekey,"ScreenSaveActive","1","REG_SZ") ENDIF
; Password protect the screen saver IF 1 <> Readvalue($screensavekey,"ScreenSaverIsSecure") WRITEVALUE("HKEY_CURRENT_USER\Control Panel\Desktop","SCRNSAVE.EXE","logon.scr","REG_SZ") WRITEVALUE($screensavekey,"ScreenSaverIsSecure","1","REG_SZ") ENDIF
|
|
Top
|
|
|
|
#105308 - 2003-10-01 04:22 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Again, this really needs to be a GPO. Registry hacking should be a last resort.
From a DC, Start/Run/GPEDIT.MSC.. Local Computer Policy/Computer Configuration/User Configuration/Control Panel/Display Hide Screen Saver tab
Enable it and you are done..
Kent
|
|
Top
|
|
|
|
#105310 - 2003-10-01 04:46 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
He said W2k.. So, is this a W2k domain or an NT Domain?
Kent
|
|
Top
|
|
|
|
#105312 - 2003-10-01 04:52 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
If memory serves.. There is a policy (Poledit) to hide the screensaver tab on a NT Domain too.
Kent
|
|
Top
|
|
|
|
#105313 - 2003-10-01 05:34 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Sparko
Fresh Scripter
Registered: 2003-10-01
Posts: 6
|
The answer you've all been waiting for.... I'm on an NT domain with W2K workstations. As far as GPO's concerned I can access other systems from my workstation, but I'm really looking for an automated solution so that I don't have to reach out and touch every individual user's PC - hence the Kixtart logon script.
Whether the use of a script in this case is a good idea or not, we still have the challenge of discovering why I can't seem to change that one registry settiing.
Cheers.
|
|
Top
|
|
|
|
#105315 - 2003-10-01 06:34 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
POLEDIT should be installed on the NT DC and you can push this to your clients via Domain Admin login.
You need to be creating a %logonserver%\netlogon\NTconfig.pol which will be replicated to the other DCs on your domain. When your clients login, they will pick up on the .POL file and apply the policies appropriately.
Kent
|
|
Top
|
|
|
|
#105316 - 2003-10-01 06:52 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Sparko
Fresh Scripter
Registered: 2003-10-01
Posts: 6
|
My Kixtart logon scripts run from a Win NT BDC. I thought that they did had admin rights as they execute when users log on to the domain. Was this a misunderstanding?
|
|
Top
|
|
|
|
#105319 - 2003-10-01 07:22 PM
Re: ADDKEY AND WRITEVALUE PROBLEMS - SCREEN SAVER TAB DISPLAY
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Sparked up POLEDIT on an NT 4 Server, and picking up our Domain Policy and we find: quote:
PolicyGroup/Control Panel/Display/Restrict display Settings for Restrict display _ | Deny access to display icon X | Hide Background tab X | Hide Screen Saver tab X | Hide Appearance tab _ | Hide Settings tab
HTH,
Kent [ 01. October 2003, 19:22: Message edited by: kdyer ]
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 837 anonymous users online.
|
|
|