Disable local admin (VBScript)

This code can be found in Chapter 2 of Windows Server 2003 Security Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This code disables the local administrator account.
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
strAdminName = "<NewAdminName>"  ' e.g. mike
' ------ END CONFIGURATION ---------

set objComputer = GetObject("WinNT://" & strComputer)
set objUser = GetObject("WinNT://" & strComputer & _
                        "/" & strAdminName & ",user")
objUser.AccountDisabled = TRUE
objUser.SetInfo
WScript.Echo "Successfully disabled account: " & strAdminName

This code has been viewed 1925 times.

New from the creators of TechTasks.com: StatSheet.com