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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to edit a registry entry. Help Please.

Status
Not open for further replies.

slowalkaway

IS-IT--Management
Feb 16, 2005
6
US
I need to edit the registry on about 100 computers.

Im trying to do this with vbscript and WMI
The registry key path is ::: Software\Microsoft\Windows\CurrentVersion\policies\system\

the name of the entry is "legalnoticetext"
the type is "REG_SZ"
then the data value is what i need to change..

THanks!
 
Nevermind I figured it out.


###############################################
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_
strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows\CurrentVersion\policies\system\"
strValueName = "legalnoticetext"
strValue = "What I want the string to be"

Return = objReg.SetStringValue( _
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue)
If (Return = 0) And (Err.Number = 0) Then
Wscript.Echo strKeyPath & _
strValue
Else
Wscript.Echo "SetStringValue failed. Error = " & Err.Number
End If
 
The best way to modifiy this value is actually through the Group Policy Object which defines that value.

Under Win2k3 you can find them under Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options and they are called "Interactive Logon: Message title for users attempting to logon" and "Interactive Logon: Message text for users attempting to logon"

The same entries exist for Windows 2000 in the same location but are called "Message title for users attempting to log on" and "Message text for users attempting to log on"

If you change those values manually and if the GPO is already defined, or becomes defined later, then they will be reset to the value defined in the GPO. Also by maintaining the values in the GPO you only have to change it there for it to be applied.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top