Starter Script

From: Honyoust (honyoustd_at_battelle.org)
Date: 07/18/03


Date: Fri, 18 Jul 2003 13:08:15 -0700


This is the script I use to manage admin passwords on our
workstations. Test it a few times and then you can place
it in a GPO as one of your logon scripts. It will only
change on the workstation if the user that logs on has
admin rights also. Copy it into note pad and then save
it as a .vbs file and you should be good to go.

Option Explicit
On Error Resume Next
Dim oShell, oEnv, oNetwork
Dim WinVer,WorS,OSVer
Set oShell = WScript.CreateObject("WScript.Shell")
Set oEnv = oShell.Environment("Process")
Set oNetwork = CreateObject("WScript.Network")

GetOS

Sub GetOS
        On Error Resume Next
        LServer = oEnvironment("LogonServer")
        LPath = LServer & "\netlogon"
        WinVer = "W2K"
        Err.Clear
        WorS = oShell.RegRead
("HKLM\System\CurrentControlSet\Control\ProductOptions\Pro
ductType")
        OSVer = oShell.RegRead
("HKLM\Software\Microsoft\Windows
NT\CurrentVersion\CurrentVersion")
        If Err.Number = 0 Then
                Select Case WorS & OSVer
                        Case "WinNT5.0" WinVer = "2KP"
                        Case "WinNT5.1" WinVer = "XPP"
                        Case "ServerNT5.0","LanmanNT5.0"
WinVer = "2000S"
                        Case "ServerNT5.2","LanmanNT5.2"
WinVer = "2003S"
                End Select

If Right(WinVer,1) = "S" Then WScript.Quit 'Exit if
Windows Server

End If
        
End Sub

Dim WSHShell, WshSysEnv, strDomain, oUser
'Set oNetwork = CreateObject("WScript.Network")
Set WSHShell = CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")
strDomain=WshSysEnv("COMPUTERNAME")
oUser="Administrator"
Set oUser = GetObject("WinNT://" & strDomain & "/" &
oUser)
' Sets password
oUser.setPassword "Enter Your Password Here"
oUser.SetInfo()
Set oUser=Nothing



Relevant Pages

  • Local Admin PW
    ... This is the script I use to manage admin passwords on our ... workstations. ... 'Set oNetwork = CreateObject ...
    (microsoft.public.win2000.security)
  • Re: Disable/Delete unused workstations
    ... This script will remove inactive machine accounts in Active Directory ... > is there a way to automatically disable or delete workstations not used in ...
    (microsoft.public.win2000.group_policy)
  • Re: Deploying Red Hat Workstations
    ... > can easily make changes to the workstations all at once. ... Have the central server push out to each host. ... > This script will contain any changes that I need to make. ... I would automate SCP from the server to a user account (not ...
    (Fedora)
  • Re: Change local administrator password for all PCs in the domain
    ... > I have about 200 workstations in my Windows 2000 domain. ... you could setup a custom script or Group Policy (in ... no workgroup machines. ...
    (microsoft.public.windows.server.scripting)
  • Re: Multiple WMI Connections
    ... I've run a similar system too, but I wrote my own ping provider because ... There was no particular bottleneck at a point in the script, ... script would iterate through 2000 workstations. ... Gerry Hickman ...
    (microsoft.public.win32.programmer.wmi)