Adding a specific reg key via script

I have a script but I want to edit the DisplayString to the following key:
HKEY_Current_User\Software\Microsoft\screensavers\Text3d  the key that I want to modify is DisplayString (REG_SZ) - I want to change from Microsoft Windows to WRMC.

Just now sure how to modify the displaystring part.  Can someone help with the words?
WellingtonISAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

motnahp00Commented:
Here's an example for you to go off of:

REG ADD "HKCU\Software\Policies\Microsoft\Windows\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 1 /f
0
WellingtonISAuthor Commented:
Can I replace the 1 with WRMC?  Not sure how to do this.  I'm just looking at the actual Key I want to modify.
0
motnahp00Commented:
One sec...
0
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

WellingtonISAuthor Commented:
OK thanks but I can't even find that key in XP...
0
motnahp00Commented:
It should look like this:

REG ADD "HKCU\Software\Microsoft\screensavers\Text3d" /v DisplayString /t REG_SZ /d WRMC /f
0
WellingtonISAuthor Commented:
Hopefully it's the same in windows 7 too. Let me add to my script and see.  Thanks!!!!
0
WellingtonISAuthor Commented:
OK what I've done is create a bat file with the key you gave me.  And though Psexec copy the bat file to the hard drive, call the bat file and delete the bat file.  all well and good but it's not copying the info to the registry unless I'm doing it on the machine directly!

@echo off
set /p var= Enter Computer Name:
set /p var2=Enter the File Name:

Psexec \\%var% -s cmd /c copy "\\computername\sharename\%var2%" c:\

psexec \\%var% -s cmd /c c:\%Var2% /q

psexec  \\%var% -s cmd /c del "c:\%var2%"
0
WellingtonISAuthor Commented:
Well I don't think I can do this remotely!  I've tried everything I can think of.
0
motnahp00Commented:
I haven't tried your method of delivery before. I typically make registry modifications via GPO or batch directly on the machine.
0
WellingtonISAuthor Commented:
May have to try GPO.  Not my first choice
0
motnahp00Commented:
I think it's better through GPO. This way you revert to your original setting(s) when you pull your machine outside the GP scope.
0
WellingtonISAuthor Commented:
Will try thanks.
0
rdiorio25Commented:
Not sure if you tried this, the example above did not have the appropriate path to the key.

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Screensavers\ssText3d" /v DisplayString /t REG_SZ /d WRMC /f



copy reg to remote machine, then execute with this.
psexec \\<computer1> -d -c regedit /s <file.reg>
0
Tony MassaCommented:
You can remotely write to a computer's registry; however, you can't easily write to "HKEY_CURRENT_USER"

If you install the Client Side Extensions for XP, and you have a 2008 domain controller, you can achieve this with Group Policy Preferences in AD.

http://www.petri.co.il/forums/showthread.php?t=47789

You could also optionally run a script (or your batch file) by using a logon script for the user as a normal GPO.
0
WellingtonISAuthor Commented:
OK I don't have 2008 yet so not an option.  I hate to do another logon script but we'll see.  I'm having a heck of a time. but I'm still testing.  I'm trying to write under the system account but it's just not working.  I have the 2008 tools for GPO's so I'm going to try to add t the registry like that 1st.  If not last resort is the logon script.
0
Tony MassaCommented:
System account has the permissions, but HKey_Current_User is not an actual path in the registry.  It's a link to the HKEY_Users_<user's objectSid> key.

http://technet.microsoft.com/en-us/library/cc976337.aspx
The HKEY_CURRENT USER subtree does not contain any data. It just stores a pointer to the content of the HKEY_USERS\ Security ID (SID) of current user subkey. Therefore, the content of that subkey also appear in HKEY_CURRENT_USER, and it can be viewed and changed in either location. This subtree provides easier access to the data.
So if you're running a script as SYSTEM, you won't be able to write to the HKCU tree, you would have to write to the HKEY_USERS_<USER SID> reg path
0
WellingtonISAuthor Commented:
OK if that's the case then I'd need to find the user sid - and then add this key REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Screensavers\ssText3d" /v DisplayString /t REG_SZ /d WRMC /f?  I can do that remotely but I just want to make sure that's what this means
0
WellingtonISAuthor Commented:
I think I actually did it by using the 2008 group policy tools and adding the registry key.  I'm going to check on it later today.
0
WellingtonISAuthor Commented:
OK it didn't work putting the registry setting in the GPO in AD.  OK so back to what you were saying.  I wonder if I can configure the registry key for all users in  a GPO?
0
WellingtonISAuthor Commented:
OK I tried by finding the user's sid connected to the registry and adding the display string.  WRMC to the Screen Savers Text 3D Screen.  It didn't work
0
Tony MassaCommented:
Not sure if this will help, but here's a script I wrote that will enumerate all domain/local user profiles on a computer with a registry change.  You can run this as a local administrator or under SYSTEM account for computer startup script.  I pulled this from another script I had working, so you'll want to test on a test PC.

On Error Resume Next
const HKEY_LOCAL_MACHINE = &H80000002 
Const HKEY_USERS = &H80000003 'HKEY_USERS 

strComputer = "." 

Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") 
objReg.EnumKey HKEY_USERS, "", arrSubKeys 

For Each subkey In arrSubKeys
  If right(subKey, 8) = "_Classes" or Len(subKey) < 10 Then
    'Do Nothing
  Else
    strUserKey = subkey
    UpdateRegistrySettings()
  End If
Next 

Function UpdateRegistrySettings()
  x = x + 1
  strKeyPath = strUserKey & "\Software\Microsoft\Windows\CurrentVersion\Screensavers\ssText3d"

  strValueName = "DisplayString"
  strValue = "WRMC"
  objReg.SetStringValue HKEY_Users, strKeyPath, strValueName, strValue
End Function

WScript.Echo x & " profiles processed"

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WellingtonISAuthor Commented:
I'll give it a shot.  Thanks
0
WellingtonISAuthor Commented:
What I actually wound up doing is using this as a bat file copying it into all users startup and letting run that way.  It's changing the registry and the screensaver is finally showing the words WRMC.  thanks for all the help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.