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

edit registry SetStringValue LegalNoticeCaption and LegalNoticeText

Status
Not open for further replies.

twospoons

IS-IT--Management
Jan 7, 2003
103
US
hello all,

i'm wanting a message to pop up before a user gets to the desktop that displays the terms and conditions of using the pc. this can happen either before the loging or after as long as they have to click on something that shows that they agree to the terms and conditions.

one idea i had was to make a vbscript that modified the LegalNoticeCaption and LegalNoticeText that i can apply through a GPO.

i've got a script to write the reg keys and add the strings to them:

Code:
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_ 
    strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows\CurrentVersion\WinLogon\"
KeyPath = "Software\Microsoft\Windows\CurrentVersion\WinLogon"
strValueName = "LegalNoticeCaption"
strValue = "End User License Agreement"

' Create key to use
Return = objReg.CreateKey(HKEY_LOCAL_MACHINE, KeyPath)
If (Return = 0) And (Err.Number = 0) Then   
    Wscript.Echo "HKEY_LOCAL_MACHINE\" & KeyPath & " created"

    ' write string value to key    
    Return = objReg.SetStringValue( _
        HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue)
    If (Return = 0) And (Err.Number = 0) Then 
        Wscript.Echo "HKEY_LOCAL_MACHINE\" & strKeyPath & strValueName & _ 
            " contains " & strValue
    Else
        Wscript.Echo "SetStringValue failed. Error = " & Err.Number
    End If
Else
    Wscript.Echo "CreateKey failed. Error = " & Err.Number
End If

but when i regedit into that key the string doesn't show up???

any ideas?
 
>Return = objReg.SetStringValue( _
> HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue)
Change it to this.
[tt]Return = objReg.SetStringValue( _
HKEY_LOCAL_MACHINE,[red]KeyPath[/red],strValueName,strValue)[/tt]
(difference by a backslash or the lack of it).

Also without on error resume next, you control on err.number is meaningless.
 
I am not so sure after running it. I am mistaken. It should do the same! So I doubt you have not pressed F5 to update?
 
fixed it... sorry i was getting frustrated...

i was looking in the wrong... place... long night i guess.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top