Starter Script
From: Honyoust (honyoustd_at_battelle.org)
Date: 07/18/03
- Next message: Honyoust: "User Logon & Logoff tracking"
- Previous message: Derek Honyoust: "Security Audits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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
- Next message: Honyoust: "User Logon & Logoff tracking"
- Previous message: Derek Honyoust: "Security Audits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|