Sysdiff Figure 3 — A Sample WSH Script That Uses All Three Registry Methods

1. ‘ VBScript to Show Use of WSH Registry Methods
2.  ‘ Script Checks for whether AutoAdmin Logon is set. If so, 
3.  ‘ It gets turned off and DefaultPassword value is deleted
4.  ‘ Declare variables
5.  Dim WSHShell,strAutoLogon,strPassword
6.  ‘ Create the Wscript Shell object, which contains the Registry methods
7.  Set WSHShell = WScript.CreateObject("WScript.Shell")
8.  ‘Get the Value of AutoAdminLogon 
9.  strAutoLogon = WSHShell.RegRead("HKLM\Software\Microsoft\Windows NT\Cur-
    rentVersion\Winlogon\AutoAdminLogon")
10. ‘Get the value of DefaultPassword
11. strPassword = WSHShell.RegRead("HKLM\Software\Microsoft\Windows NT\Cur-
    rentVersion\Winlogon\DefaultPassword")
12. ‘Check to see if AutoAdminLogon is enabled
13. ‘If enabled, turn it off
14. if strAutoLogon="1" then
    15. WSHShell.Popup "Auto Admin Logon is enabled. Disabling Now"
    16. WSHShell.RegWrite "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon", 0
    17. ‘If Default Password is not blank, then get rid of the value
    18. if strPassword <>"" then
        19. WSHShell.Popup "Deleting Password Value Now"
        20. WSHShell.RegDelete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword"
    21. end if
22. end if
23. WScript.Quit(0)