Guest User

Untitled

a guest
May 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. Dim objShell
  2. Dim strMessage, strWelcome, strWinLogon
  3.  
  4. ' Set the string values
  5. strWelcome = "legalnoticecaption"
  6. strMessage = "did this work"
  7. strWinLogon = "HKLMSOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem"
  8.  
  9. ' Create the Shell object
  10. Set wshShell = CreateObject("WScript.Shell")
  11.  
  12. 'Display string Values
  13. Wscript.Echo "key to update: " & strWelcome
  14. Wscript.Echo "key value to enter: " & strMessage
  15. Wscript.Echo "Existing key value: " & wshShell.RegRead(strWinLogon & strWelcome)
  16.  
  17.  
  18. ' the crucial command in this script - rewrite the registry
  19. wshShell.RegWrite strWinLogon & strWelcome, strMessage, "REG_SZ"
  20.  
  21. ' Did it work?
  22. Wscript.Echo "new key value: " & wshShell.RegRead(strWinLogon & strWelcome)
  23.  
  24. set wshShell = Nothing
  25.  
  26. option explicit
  27. On Error Goto 0
  28. Dim wshShell
  29. Dim strResult, strMessage, strWelcome, strWinLogon, strWinLog_2, strWinLTxt
  30. strResult=Wscript.ScriptName
  31.  
  32. ' Set the string values
  33. strWinLTxt = "legalnoticetext"
  34. strWelcome = "legalnoticecaption"
  35. strMessage = "did this work"
  36.  
  37. strWinLogon = "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon"
  38. strWinLog_2 = "HKLMSOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem"
  39.  
  40. ' Create the Shell object
  41. Set wshShell = CreateObject("WScript.Shell")
  42.  
  43. 'Display string Values
  44. ' continue execution if requested registry values not present
  45. On Error Resume Next
  46. strResult = strResult & vbNewLine & "Existing Caption Policies: " _
  47. & wshShell.RegRead(strWinLog_2 & strWelcome)
  48. strResult = strResult & vbNewLine & "Existing Text Policies: " _
  49. & wshShell.RegRead(strWinLog_2 & strWinLTxt)
  50. On Error Goto 0
  51. strResult = strResult & vbNewLine & "Existing Caption Winlogon: " _
  52. & wshShell.RegRead(strWinLogon & strWelcome)
  53. strResult = strResult & vbNewLine & "Existing Text Winlogon: " _
  54. & wshShell.RegRead(strWinLogon & strWinLTxt)
  55. strResult = strResult & vbNewLine
  56. strResult = strResult & vbNewLine & "key to update: " & strWelcome
  57. strResult = strResult & vbNewLine & "key value to enter: " & strMessage
  58.  
  59.  
  60. ' the crucial command in this script - rewrite the registry
  61. wshShell.RegWrite strWinLogon & strWelcome, strMessage, "REG_SZ"
  62. wshShell.RegWrite strWinLogon & strWinLTxt, UCase( strMessage), "REG_SZ"
  63.  
  64. ' Did it work?
  65. strResult = strResult & vbNewLine
  66. strResult = strResult & vbNewLine _
  67. & "new key Capt. value: " & wshShell.RegRead(strWinLogon & strWelcome)
  68. strResult = strResult & vbNewLine _
  69. & "new key Text value: " & wshShell.RegRead(strWinLogon & strWinLTxt)
  70. Wscript.Echo strResult
  71. set wshShell = Nothing
Add Comment
Please, Sign In to add comment