Home / Microsoft / Microsoft DOS / Change screensaver registry remotely...
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 4  All - (Bottom) Print
Author Topic: Change screensaver registry remotely...  (Read 9827 times)
TheHoFL
Topic Starter
Intermediate



Thanked: 5
Posts: 174


« on: June 09, 2009, 04:48:05 PM »

Hello again...

I have now been given the task of pushing a screen saver to around 25 computers. Then i need to set the screen saver to be he default for all users.

I need to have a folder with a folder labeled "screen_saver" in it.

This is what i have...i know it looks as though a newb wrote it  :)

What is does is copy the screensaver file then needs t o set it as the default. I am just having issues with the remote registry part.  ???

Code: [Select]
copy /Y "screen_saver\newSS.scr" "\\timscomputer\c$\windows\System32"

REG ADD "\\timscomputer\HKCU\Control Panel\Desktop" /V SCRNSAVE.EXE /T REG_SZ /F /D "%SystemRoot%\System32\newSS.scr"

REG ADD "\\timscomputer\HKCU\Control Panel\Desktop" /V ScreenSaveActive /T REG_SZ /F /D 1

When running that i get the following:
Quote
        1 file(s) copied.
Press any key to continue . . .

Error:  A remote machine was specified, the root key must be HKLM or HKU.

Error:  A remote machine was specified, the root key must be HKLM or HKU.
Press any key to continue . . .

Can anyone assist me with this. I cannot find the key in HKLM for the screensaver.

Thank you guys and gals!
IP logged

All your dreams can come true if you have the courage to pursue them.  - Walt Disney
BatchFileBasics
Hopeful



Thanked: 18
Posts: 387


BatchFileBasics
« Reply #1 on: June 09, 2009, 04:52:21 PM »

well im no genious with registry, but the error says :
Error:  A remote machine was specified, the root key must be HKLM or HKU.

you have it as:
REG ADD "\\timscomputer\HKCU\Control Panel\Desktop" /V SCRNSAVE.EXE /T REG_SZ /F /D "%SystemRoot%\System32\newSS.scr"
IP logged

When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.
TheHoFL
Topic Starter
Intermediate



Thanked: 5
Posts: 174


« Reply #2 on: June 09, 2009, 04:55:40 PM »

Hmmm.... very true. So i looked in HKU and there is a ".DEFAULT" string. I can drill down and find the keys. However i thought if i made that change there it would only effect the new user profiles that were created and do nothing with the already made user profiles?
IP logged

All your dreams can come true if you have the courage to pursue them.  - Walt Disney
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,882

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #3 on: June 09, 2009, 05:00:08 PM »

HKCU is HKEY_CURRENT_USER

HKU is HKEY_USERS

the problem here is that TheHoFL would then need to parse the crud in the HKEY_USERS key, and find out which one corresponds with the current user. (or, perhaps place it in all of them?) (I'm the sole user of my PC, and I have over 10 entries in there!)

really, a better method would be to simply put it in HKEY_LOCAL_MACHINE (HKLM)- or,  if possible, simply add a VBScript that will start up for each user, that copies the screensaver from a network drive (perhaps an unmapped share) to the local machine and sets it up locally (where it has access to HKEY_CURRENT_USER).



TO explore why this limitation exists, it seems quite obvious- you can perform remote registry procedures when no user is logged in! In which case, HKEY_CURRENT_USER is undefined. Additionally, it can easily change between calls, if somebody logs off and another logs back off, which can mean that the first half of registry entries go to one, and the second half to another account. Generally not a good thing!
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
TheHoFL
Topic Starter
Intermediate



Thanked: 5
Posts: 174


« Reply #4 on: June 09, 2009, 05:17:19 PM »

I would much rather make the cahnge in HKLM, but i cannot find the string the key would be in, if there is one in there.
IP logged

All your dreams can come true if you have the courage to pursue them.  - Walt Disney
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,882

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #5 on: June 09, 2009, 05:20:29 PM »

oh, your right. there isn't one.

what about the idea of running a batch file at logon? and if you already do, it should be a simple change to that script.





IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
TheHoFL
Topic Starter
Intermediate



Thanked: 5
Posts: 174


« Reply #6 on: June 09, 2009, 05:22:52 PM »

That would be another excellent idea. I can not do that because we already have a logon.bat that is run at logon that is pushed from our home office location. They will not let us mess with it much. Do you know of any BAT file that could pull the users names and/or change a registry setting for every user profile on a remote computer?


EDIT: I tried remotely setting the regisrty setting in the following location and it did NOT apply to a profile that was already created. It did work when creating a new one though.
Code: [Select]
\\U1jbennett\HKU\.DEFAULT\Control Panel\Desktop
IP logged

All your dreams can come true if you have the courage to pursue them.  - Walt Disney
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,882

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #7 on: June 09, 2009, 05:24:42 PM »

well... it would be possible via VBScript.

But I'm too used to my own registry class in Visual Basic, so I'll have to do a little research on the VBScript methods for changing/enumerating registry data.

Are you able to use VBScript?
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
TheHoFL
Topic Starter
Intermediate



Thanked: 5
Posts: 174


« Reply #8 on: June 09, 2009, 05:26:00 PM »

I suppose i could. VBS is fairly new to me though. So i may ask you some more newbie questions.  ;)
IP logged

All your dreams can come true if you have the courage to pursue them.  - Walt Disney
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,882

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #9 on: June 09, 2009, 05:42:46 PM »

well, VBScript might be out- because- get this-


it uses WMI, and I believe you recently disabled that?

oh the irony!  :P
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
TheHoFL
Topic Starter
Intermediate



Thanked: 5
Posts: 174


« Reply #10 on: June 09, 2009, 05:50:03 PM »

No that was on a different group of computers.  :P
IP logged

All your dreams can come true if you have the courage to pursue them.  - Walt Disney
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,882

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #11 on: June 09, 2009, 05:50:45 PM »

Oh OK- maybe I can work out something with VBScript then.
IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
TheHoFL
Topic Starter
Intermediate



Thanked: 5
Posts: 174


« Reply #12 on: June 09, 2009, 05:51:11 PM »

Thank you so much for your help!
IP logged

All your dreams can come true if you have the courage to pursue them.  - Walt Disney
BC_Programmer
Mastermind


Thanked: 697
Posts: 15,882

Computer: Specs
Experience: Beginner
OS: Windows 7


Pinkie Pie is best pony

BC-Programming.com 1 1
« Reply #13 on: June 09, 2009, 06:21:06 PM »

OK, here's something to try:

Code: [Select]
Sub SetKeysForMachine(Byval MachineName)
const HKEY_USERS = &H80000003



strComputer = MachineName
Set StdOut = WScript.StdOut

stdout.WriteLine "Connecting to " & machineName

'Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
'MachineName & "\root\default:StdRegProv")
set oReg = GetObject("WinMgmts:{impersonationLevel=impersonate}!//" & strComputer & "/root/default:stdRegProv")
strKeyPath = ""
oReg.EnumKey HKEY_USERS, strKeyPath, arrSubKeys
'REG ADD "\\timscomputer\HKCU\Control Panel\Desktop" /V SCRNSAVE.EXE /T REG_SZ /F /D "%SystemRoot%\System32\newSS.scr"

'REG ADD "\\timscomputer\HKCU\Control Panel\Desktop" /V ScreenSaveActive /T REG_SZ /F /D 1
For Each subkey In arrSubKeys
    'StdOut.WriteLine subkey
    'save subkey\Control Panel\Desktop value, screensaveactive.
strKeyPath = subkey & "\Control Panel\Desktop"
strValueName = "ScreenSaveActive"
strValue = "1"
oReg.SetStringValue HKEY_USERS,strKeyPath,strValueName,strValue

oReg.SetStringvalue HKEY_USERS,Strkeypath,"SCRNSAVE.EXE", "%SystemRoot%\System32\newSS.scr"




Next

End Sub

Dim mmachineNames()
Const NumMachines =2
redim mmachinenames(NumMachines-1)

'Change this portion, to reflect the actual number of machines (the above constant) as well as their names.
mmachinenames(0) = "." 'this reflects the local machine. This was for my testing, change it :P
mmachinenames(1) = "SATELLITE"
on error resume next
Dim I ,X
'for each machine in mmachinenames
For I = 0 to ubound(mmachinenames)

SetKeysForMachine mmachinenames(I)
if err <> 0 then
wScript.stdOut.WriteLine "Error processing machine, " & mmachinenames(I)
Else
X=X+1
end if
next

wScript.stdOut.WriteLine "Script finished. Successfully processed " & X & " of " & ubound(mmachinenames)+1 & " Machines."

You'll still need to use the batch, to copy the screensaver. And then you can, instead of using REG ADD in your batch script, run "Cscript newscript.vbs"

remember, however, to modify the lines:

Code: [Select]
Const NumMachines =2

and


Code: [Select]
mmachinenames(0) = "." 'this reflects the local machine. This was for my testing, change it :P
mmachinenames(1) = "SATELLITE"

to reflect the names of the PCs your fiddling with on the network, as well as the number.


In my testing I was getting permission denied when it tried to change my laptop, "SATELLITE"'s, registry. I think it was simply the way I had things configured- not necessarily a network setup.

I hope the remote portions work for you. It reports the number that suceed after the script runs- (it doesn't quit of one fails, so if, say, one of the PCs is off, it won't simply stop there).

IP logged

My Blog

BASeBlock 2.3.0 (NOW WITH MACGUFFINS!)
gh0std0g74
Apprentice



Thanked: 37
Posts: 590


« Reply #14 on: June 10, 2009, 03:49:18 AM »

@BC, i didn't see OP's mentioned WMI is disabled (maybe i missed), if so, wouldn't the vbscript not work as it use WMI??
IP logged

Pages: [1] 2 3 4  All - (Top) Print 
Home / Microsoft / Microsoft DOS / Change screensaver registry remotely... « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.102 seconds with 20 queries.