Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Registry Value - Why not working?

Status
Not open for further replies.

tcspine

IS-IT--Management
Jan 2, 2008
31
0
0
US
I'm creating a script that will change users dekstop background 'color' to white. I'm pretty much a noob and haven't done many scripts, but this one isn't working and I can't see why. Can someone help please?



Option Explicit
' On Error Resume Next
Dim strKeyPath ' the portion of registry to read
Dim StrValueName
Dim strColor ' the target computer
Dim objReg ' holds connection to registry provider

Const HKCU = &H80000001 'HKEY_CURRENT_USER

strKeyPath = "HKEY_CURRENT_USER\Control Panel\Colors\Background"
strColor = "255 255 255" 'white
strValueName = "Background"

Set objReg=GetObject("winmgmts:\\" & "." & "\root\default:StdRegProv")

objReg.SetStringValue(HKCU,strKeyPath,strValueName,strColor)


 
Try replacing this:

strKeyPath = "HKEY_CURRENT_USER\Control Panel\Colors\Background"

With this:
strKeyPath = "Control Panel\Colors\Background"


I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top