Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim objShell
- Dim strMessage, strWelcome, strWinLogon
- ' Set the string values
- strWelcome = "legalnoticecaption"
- strMessage = "did this work"
- strWinLogon = "HKLMSOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem"
- ' Create the Shell object
- Set wshShell = CreateObject("WScript.Shell")
- 'Display string Values
- Wscript.Echo "key to update: " & strWelcome
- Wscript.Echo "key value to enter: " & strMessage
- Wscript.Echo "Existing key value: " & wshShell.RegRead(strWinLogon & strWelcome)
- ' the crucial command in this script - rewrite the registry
- wshShell.RegWrite strWinLogon & strWelcome, strMessage, "REG_SZ"
- ' Did it work?
- Wscript.Echo "new key value: " & wshShell.RegRead(strWinLogon & strWelcome)
- set wshShell = Nothing
- option explicit
- On Error Goto 0
- Dim wshShell
- Dim strResult, strMessage, strWelcome, strWinLogon, strWinLog_2, strWinLTxt
- strResult=Wscript.ScriptName
- ' Set the string values
- strWinLTxt = "legalnoticetext"
- strWelcome = "legalnoticecaption"
- strMessage = "did this work"
- strWinLogon = "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon"
- strWinLog_2 = "HKLMSOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem"
- ' Create the Shell object
- Set wshShell = CreateObject("WScript.Shell")
- 'Display string Values
- ' continue execution if requested registry values not present
- On Error Resume Next
- strResult = strResult & vbNewLine & "Existing Caption Policies: " _
- & wshShell.RegRead(strWinLog_2 & strWelcome)
- strResult = strResult & vbNewLine & "Existing Text Policies: " _
- & wshShell.RegRead(strWinLog_2 & strWinLTxt)
- On Error Goto 0
- strResult = strResult & vbNewLine & "Existing Caption Winlogon: " _
- & wshShell.RegRead(strWinLogon & strWelcome)
- strResult = strResult & vbNewLine & "Existing Text Winlogon: " _
- & wshShell.RegRead(strWinLogon & strWinLTxt)
- strResult = strResult & vbNewLine
- strResult = strResult & vbNewLine & "key to update: " & strWelcome
- strResult = strResult & vbNewLine & "key value to enter: " & strMessage
- ' the crucial command in this script - rewrite the registry
- wshShell.RegWrite strWinLogon & strWelcome, strMessage, "REG_SZ"
- wshShell.RegWrite strWinLogon & strWinLTxt, UCase( strMessage), "REG_SZ"
- ' Did it work?
- strResult = strResult & vbNewLine
- strResult = strResult & vbNewLine _
- & "new key Capt. value: " & wshShell.RegRead(strWinLogon & strWelcome)
- strResult = strResult & vbNewLine _
- & "new key Text value: " & wshShell.RegRead(strWinLogon & strWinLTxt)
- Wscript.Echo strResult
- set wshShell = Nothing
Add Comment
Please, Sign In to add comment