Board index » Visual Studio » HOW TO: Determine if a user is Disabled
|
beschler
|
|
beschler
|
HOW TO: Determine if a user is Disabled
Visual Studio325
I wrote a script a few months ago that we ran through our environment to determine what local users existed on the workstations. If I found any "non-approved" locally created (non-domain) users in the Administrators or Power Users groups I disabled them. Now I want to go through and delete those disabled users. Is there a scripting way to determine if a local user is disabled? Thanks, Tom - |
| Torgeir
Registered User |
Wed Nov 12 13:54:30 CST 2003
Re:HOW TO: Determine if a user is Disabled
Tom Ker wrote:
QuoteI wrote a script a few months ago that we ran through our environment to sUser = "some user" Set oWshNet = CreateObject("WScript.Network") Set oUser = GetObject("WinNT://" _ & oWshNet.ComputerName & "/" & sUser & ",user") bUserDisabled = CBool(oUser.AccountDisabled) If bUserDisabled Then WScript.Echo "User is disabled" Else WScript.Echo "User is not disabled" End If -- torgeir Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: www.microsoft.com/technet/scriptcenter">www.microsoft.com/technet/scriptcenter - |
| Tom
Registered User |
Thu Nov 13 06:06:26 CST 2003
Re:HOW TO: Determine if a user is Disabled
Thanks, Torgeir. Works great!
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com>wrote in message Quote
- |
