#116235 - 2004-03-17 12:02 AM
screensaver/registry issue - little help?
|
MDavis
Fresh Scripter
Registered: 2004-01-05
Posts: 40
Loc: New Orleans, LA
|
Okay, this is the same script I have been working on for 3 days now, WOOHOO! It is certainly coming along, but I am having some issues wit hthe screensaver. All of the changes are being done remotely from a PC having a logged in user with domain admin priv. The workstation I am testing on is a w2k with service pack 4. I have browsed throughout the site looking for similar issues and I am trying the solutions, but I don't get the results I want. The problem I am having is that even though I set the screensaver in both keys mentioned throughout the site the screen saver when browsed through display properties say there is "none" specified. I check the keys, I restart the system, but still no dice. I even tried writing to system.ini based on another thread...nothing. If I could get some fresh eyes to look at my script and see where it is I am going wrong, that would be awesome. I am also using the latest version of Kix. I think that is everything can include, if I have left something out, just ask. Thanks.
Code:
Dim $RID, $regKUpwr, $regDefpwr, $regKUdesk, $regKUcpl, $regLMcpl, $regLMCV, $r, $comp, $sysini Dim $SID, $domain, $user, $HKU, $HKLM, $u, $SystemRoot, $DEFAULT, $IE, $IEshare, $cshare
Call getsid.kix Call loggedinusers.kix Call StopProc.kix
$domain = "SALCO1" $comp = "TESTBOX" $tcomp = "\\" + $comp $HKU = "\HKEY_USERS\" $HKLM = "\HKEY_LOCAL_MACHINE" $DEFAULT = $HKU + ".DEFAULT"
$u = loggedinusers($comp)
If Ubound($u) = -1 ? "Noone Logged in" Else $user = $u[0] $user = Split($user,"\")[1] $IE = "C:\Documents And Settings\" + $user + "\Application Data\Microsoft\Internet Explorer" $IEshare = "\C$\Documents And Settings\" + $user + "\Application Data\Microsoft\Internet Explorer" $SID = getsid("WinNT://" + $domain+ "/" + $user + ",USER") $regKUpwr = $HKU + $SID + "\Control Panel\PowerCfg" $regDefpwr = $DEFAULT + "\Control Panel\PowerCfg" $regKUdesk = $HKU + $SID + "\Control Panel\Desktop" $regKUcpl = $HKU + $SID + "\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" $regLMcpl = $HKLM + "\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" $regKUCV = $HKLM + "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" $regKUPoldesk = $HKU + $SID + "\Software\Policies\Microsoft\Windows\Control Panel\Desktop" $SystemRoot = ReadValue($tcomp + $regKUCV,"SystemRoot")
Select Case $SystemRoot = "c:\WINNT" $cshare = "\c$\winnt" Case $SystemRoot = "c:\windows" $cshare = "\c$\windows" Case 1 ? "boo" EndSelect $sysini = $cshare + "\System.ini"
$RID = Split($SID,"-")[7] If $RID = 500 ? $RID Else EndIf
$r = WriteValue($tcomp + $regKUpwr,"CurrentPowerPolicy","3","REG_SZ") $r = WriteValue($tcomp + $regDefpwr,"CurrentPowerPolicy","3","REG_SZ")
;$r = WriteValue($tcomp + $regKUcpl,"NoControlPanel","1","REG_DWORD") ;$r = WriteValue($tcomp + $regLMcpl,"NoControlPanel","1","REG_DWORD")
$r = WriteValue($tcomp + $regKUdesk,"ScreenSaverIsSecure","1","REG_SZ") $r = WriteValue($tcomp + $regKUdesk,"ScreenSaveActive","1","REG_DWORD") $r = WriteValue($tcomp + $regKUdesk,"SCRNSAVE.EXE", $SystemRoot + "\system32\logon.scr","REG_SZ") $r = WriteValue($tcomp + $regKUPoldesk,"ScreenSaverIsSecure","1","REG_SZ") $r = WriteValue($tcomp + $regKUPoldesk,"ScreenSaveActive","1","REG_DWORD") $r = WriteValue($tcomp + $regKUPoldesk,"SCRNSAVE.EXE", $SystemRoot + "\system32\logon.scr","REG_SZ")
Copy salco.bmp $tcomp + "\c$" If Exist($tcomp + $IEshare + "\Internet Explorer Wallpaper.bmp") Del $tcomp + $IEshare +"\Internet Explorer Wallpaper.bmp" Else EndIf
If Exist($tcomp + $IEshare + "\Internet Explorer Wallpaper.bmp") Del $tcomp + $IEshare + "\Internet Explorer Wallpaper.bmp" Else EndIf
If Exist($tcomp + $cshare + "\Webshots for " + $user + ".bmp") Del $tcomp + $cshare + "\Webshots for " + $user + ".bmp" Else EndIf
If Exist($tcomp + $cshare + "\webshots.scr") StopProc("Webshots.scr",$comp) Del $tcomp + $cshare + "\webshots.scr" /f Else EndIf
MD $tcomp + $cshare + "\Webshots for " + $user + ".bmp" MD $tcomp + $cshare + "\webshots.scr" MD $tcomp + $IEshare + "\Internet Explorer Wallpaper.bmp\"
If $SystemRoot + "\System32\logon.scr" <> ReadProfileString($tcomp + $sysini,"boot","scrnsave.exe") $r = WriteProfileString($tcomp + $sysini,"boot","scrnsave.exe",$SystemRoot + "\System32\logon.scr") ? @SERROR Else EndIf $r = WriteValue($tcomp + $regKUdesk,"Wallpaper","C:\salco.bmp","REG_SZ") $r = WriteValue($tcomp + $regKUdesk,"WallpaperStyle","0","REG_SZ") EndIf
_________________________
Micah Davis
"A truly wise man never plays leapfrog with a unicorn."
|
|
Top
|
|
|
|
#116238 - 2004-03-17 06:00 PM
Re: screensaver/registry issue - little help?
|
MDavis
Fresh Scripter
Registered: 2004-01-05
Posts: 40
Loc: New Orleans, LA
|
Jens, Would rebooting or logging off and logging back on duplicate the effect of the UpdateUserParameters() UDF? I've rebooted the system in an attempt to apply the settings in hope that was the issue but to no avail.
NTDOC,
I'll try the debug statements. I had a ?@serror after every function and everything was coming back successfull, but maybe I've missed somethng. The registry value is certainly being update correctly, that is where the confusion comes in. Everything looks perfect in the registry as per the instructions I have found, it is just the the screensaver is saying 'none'. The reason we aren't doing this via the server is for a couple reasons; We are considering doing an update to 2003 and my boss wanted to wait until 2003 was here so we could start from the ground up and do things right. We also needed a quick fix for it (it seems like the quick fix is turning into a drawn out fix). I am the only one here doing any of these types of changes too, and I am having to learn as I go. Not everything is set up the way it should have been from the start and have little support to make changes to server aspects, so I have to do it from the user end. I do however need to learn about making custom policies, it's something I not ALL the familiar with right now. As far as the screensavers and wallpapers are concerned, we use VNC to remote to the machines and VNC doesn't always remove the wallapapers that are on the remote machines like it should, and it is a real pain to try to navigate a machine via VNC with it trying to contantly refresh the wallpaper. The screensavers are just for conformity and for webshots.
Thanks so much for the recommendations, I'm going to try those and I'll get back with you.
_________________________
Micah Davis
"A truly wise man never plays leapfrog with a unicorn."
|
|
Top
|
|
|
|
#116242 - 2004-03-17 06:50 PM
Re: screensaver/registry issue - little help?
|
Richie19Rich77
Seasoned Scripter
   
Registered: 2002-08-16
Posts: 624
Loc: London, England
|
Hi
Have a look at the following code, the important part is "setm 'ss='"
Code:
;Check/Modify ScreenSaver Settings if @producttype="Windows 2000 Professional" $ss_key="HKEY_CURRENT_USER\Control Panel\Desktop" $ss_name=readvalue($ss_key,"SCRNSAVE.EXE") $ss_secure=readvalue($ss_key,"ScreenSaverIsSecure") $ss_timeout=readvalue($ss_key,"ScreenSaveTimeOut") if $ss_name="" $=WRITEVALUE($ss_key,"SCRNSAVE.EXE","C:\WINNT\SYSTEM32\LOGON.SCR","REG_SZ") endif if $ss_secure=0 $=WRITEVALUE($ss_key,"ScreenSaverIsSecure","1","REG_SZ") endif if (val($ss_timeout) <= 300 ) OR (val($ss_timeout) > 1800) $=WRITEVALUE($ss_key,"ScreenSaveTimeOut","900","REG_SZ") endif setm 'ss=' endif
|
|
Top
|
|
|
|
#116244 - 2004-03-17 10:31 PM
Re: screensaver/registry issue - little help?
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4562
Loc: USA
|
You don't have to change that line at all. SETM SS= is just setting a arbitrary variable(SS) to nothing. But when you do this, it makes explorer check the settings in the registry for updates. This doesn't work for everything, but it usually works for Screensaver settings.
See this post for more details: Applying Registry Settings
I would be willing to bet, Jen's UDF does very much the same thing, so if that UDF is not working, this may not work either.
|
|
Top
|
|
|
|
#116252 - 2004-03-17 11:38 PM
Re: screensaver/registry issue - little help?
|
MDavis
Fresh Scripter
Registered: 2004-01-05
Posts: 40
Loc: New Orleans, LA
|
Jens, I am sure that is the case, but all I know is that no matter how many times I changed HKCU\Cpl\Desktop it did not change the screensaver, but ONLY the specific screensaver I was defining, all other settings worked, i.e. screensaversecure, screensaveractive. When I wrote to HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop it set the screensaver no problems.
I ran through the script with debug on and I figured out that it is saying that the system cannot find the file specified. Maybe there is extensive funtionability to debug on that I am not aware of, but all I could see was the ability to see what happens line by line. It tries to apply the setting and then it hits the ? @SERROR i have positioned after it and it spits out that the system cannot find the file specified.
Les,
No, really I totally understand that. And I am not disagreeing with that fact, I am just telling you what is happening, not what is SUPPOSED to happen. When I am writing to HKCU it is NOT adding the key to HKU\SID, don't ask my why not...it just isn't. I've checked a couple times now.
I am certainly not trying to tell either of you "how it is supposed to be" I am just explaining what my own eyes have seen. Maybe I should move the test pc to Eerie Indiana?
_________________________
Micah Davis
"A truly wise man never plays leapfrog with a unicorn."
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|