PC Review


Reply
Thread Tools Rate Thread

Change multiple accounts

 
 
Mark Warbeck
Guest
Posts: n/a
 
      28th Jan 2004
On occasion our Active Directory is attacked and hundreds of users get
locked out. They don't like waiting 30 minutes for the lockout to expire. Is
there a tool or script that will allow me to unlock all accounts at once?
It's tedious to unlock them one by one.

Thanks,
Mark


 
Reply With Quote
 
 
 
 
Richard McCall [MSFT]
Guest
Posts: n/a
 
      28th Jan 2004
First I would find the cause and prevent it.

Otherwise here us a sample script that shows how to unlock accounts
Resetting All Locked-Out User Accounts for a Domain Using a VBScript Active
Server Page

Dim Domain
Dim UserAccount
Dim Counter
Dim DomainName
Counter = 0
DomainName = "Target_Domain_Name"
Set Domain = GetObject("WinNT://" & DomainName)
Domain.Filter = Array("User")
For Each UserAccount In Domain
If UserAccount.IsAccountLocked = True Then
Response.Write UserAccount.Name
UserAccount.IsAccountLocked = False
UserAccount.SetInfo
Counter = Counter + 1
End If
Next
If Counter >0 Then
Response.Write Counter & " user accounts were unlocked in the " &
Domain.Name & " domain."
Else
Response.Write "No user accounts in the " & Domain.Name & " domain were
locked."
End If

--
Richard McCall [MSFT]

"This posting is provided "AS IS" with no warranties, and confers no
rights."
"Mark Warbeck" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> On occasion our Active Directory is attacked and hundreds of users get
> locked out. They don't like waiting 30 minutes for the lockout to expire.

Is
> there a tool or script that will allow me to unlock all accounts at once?
> It's tedious to unlock them one by one.
>
> Thanks,
> Mark
>
>



 
Reply With Quote
 
Mark Warbeck
Guest
Posts: n/a
 
      28th Jan 2004
Richard,

Thanks for the quick response. I copied your code into a file with the .vbs
extention. I changed "Target_Domain_Name" to the name of my domain. I get
the following error:

Line: 11
Char: 11
Error: Object required: 'Response'
Code: 800A01A8
Source: Microsoft VBScript runtime error

This KB article seems to apply but I don't understand it.

http://support.microsoft.com/default...b;en-us;224422

Thanks for any additional help.

Mark


"Richard McCall [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> First I would find the cause and prevent it.
>
> Otherwise here us a sample script that shows how to unlock accounts
> Resetting All Locked-Out User Accounts for a Domain Using a VBScript

Active
> Server Page
>
> Dim Domain
> Dim UserAccount
> Dim Counter
> Dim DomainName
> Counter = 0
> DomainName = "Target_Domain_Name"
> Set Domain = GetObject("WinNT://" & DomainName)
> Domain.Filter = Array("User")
> For Each UserAccount In Domain
> If UserAccount.IsAccountLocked = True Then
> Response.Write UserAccount.Name
> UserAccount.IsAccountLocked = False
> UserAccount.SetInfo
> Counter = Counter + 1
> End If
> Next
> If Counter >0 Then
> Response.Write Counter & " user accounts were unlocked in the " &
> Domain.Name & " domain."
> Else
> Response.Write "No user accounts in the " & Domain.Name & " domain

were
> locked."
> End If
>
> --
> Richard McCall [MSFT]
>
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
> "Mark Warbeck" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > On occasion our Active Directory is attacked and hundreds of users get
> > locked out. They don't like waiting 30 minutes for the lockout to

expire.
> Is
> > there a tool or script that will allow me to unlock all accounts at

once?
> > It's tedious to unlock them one by one.
> >
> > Thanks,
> > Mark
> >
> >

>
>



 
Reply With Quote
 
Torgeir Bakken (MVP)
Guest
Posts: n/a
 
      28th Jan 2004
Mark Warbeck wrote:

> Richard,
>
> Thanks for the quick response. I copied your code into a file with the .vbs
> extention. I changed "Target_Domain_Name" to the name of my domain. I get
> the following error:
>
> Line: 11
> Char: 11
> Error: Object required: 'Response'
> Code: 800A01A8
> Source: Microsoft VBScript runtime error


Hi

Response.Write is used from an ASP page and will not work in an ordinary
vbscript file. Replace "Response.Write" with "Wscript.Echo" and run your
vbscript in a command prompt with cscript.exe, like this:

cscript.exe "some script file.vbs"

If you want the output into a file instead, you can use this:

cscript.exe "some script file.vbs" > "some log file.txt"


--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


 
Reply With Quote
 
Richard McCall [MSFT]
Guest
Posts: n/a
 
      28th Jan 2004
The script is design to run in an ASP page to get it to run as a standalone
vbs script use this version instead. The only change is the output.
Response.Write vs wscript.echo. Make sure the Target Domain Name is in
Quotes

Call the script via the command prompt
c:\cscript unlock.vbs
Dim Domain
Dim UserAccount
Dim Counter
Dim DomainName
Counter = 0
DomainName = "Target_Domain_Name"
Set Domain = GetObject("WinNT://" & DomainName)
Domain.Filter = Array("User")
For Each UserAccount In Domain
If UserAccount.IsAccountLocked = True Then
wscript.echo UserAccount.Name
UserAccount.IsAccountLocked = False
UserAccount.SetInfo
Counter = Counter + 1
End If
Next
If Counter >0 Then
wscript.echo Counter & " user accounts were unlocked in the " &
Domain.Name & " domain."
Else
wscript.echo "No user accounts in the " & Domain.Name & " domain were
locked."
End If

--
Richard McCall [MSFT]

"This posting is provided "AS IS" with no warranties, and confers no
rights."
"Mark Warbeck" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Richard,
>
> Thanks for the quick response. I copied your code into a file with the

..vbs
> extention. I changed "Target_Domain_Name" to the name of my domain. I get
> the following error:
>
> Line: 11
> Char: 11
> Error: Object required: 'Response'
> Code: 800A01A8
> Source: Microsoft VBScript runtime error
>
> This KB article seems to apply but I don't understand it.
>
> http://support.microsoft.com/default...b;en-us;224422
>
> Thanks for any additional help.
>
> Mark
>
>
> "Richard McCall [MSFT]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > First I would find the cause and prevent it.
> >
> > Otherwise here us a sample script that shows how to unlock accounts
> > Resetting All Locked-Out User Accounts for a Domain Using a VBScript

> Active
> > Server Page
> >
> > Dim Domain
> > Dim UserAccount
> > Dim Counter
> > Dim DomainName
> > Counter = 0
> > DomainName = "Target_Domain_Name"
> > Set Domain = GetObject("WinNT://" & DomainName)
> > Domain.Filter = Array("User")
> > For Each UserAccount In Domain
> > If UserAccount.IsAccountLocked = True Then
> > Response.Write UserAccount.Name
> > UserAccount.IsAccountLocked = False
> > UserAccount.SetInfo
> > Counter = Counter + 1
> > End If
> > Next
> > If Counter >0 Then
> > Response.Write Counter & " user accounts were unlocked in the " &
> > Domain.Name & " domain."
> > Else
> > Response.Write "No user accounts in the " & Domain.Name & " domain

> were
> > locked."
> > End If
> >
> > --
> > Richard McCall [MSFT]
> >
> > "This posting is provided "AS IS" with no warranties, and confers no
> > rights."
> > "Mark Warbeck" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > On occasion our Active Directory is attacked and hundreds of users get
> > > locked out. They don't like waiting 30 minutes for the lockout to

> expire.
> > Is
> > > there a tool or script that will allow me to unlock all accounts at

> once?
> > > It's tedious to unlock them one by one.
> > >
> > > Thanks,
> > > Mark
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Mark Warbeck
Guest
Posts: n/a
 
      28th Jan 2004
Thanks for the help. It will save me lots of time and effort.

Mark


"Richard McCall [MSFT]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> The script is design to run in an ASP page to get it to run as a

standalone
> vbs script use this version instead. The only change is the output.
> Response.Write vs wscript.echo. Make sure the Target Domain Name is in
> Quotes
>
> Call the script via the command prompt
> c:\cscript unlock.vbs
> Dim Domain
> Dim UserAccount
> Dim Counter
> Dim DomainName
> Counter = 0
> DomainName = "Target_Domain_Name"
> Set Domain = GetObject("WinNT://" & DomainName)
> Domain.Filter = Array("User")
> For Each UserAccount In Domain
> If UserAccount.IsAccountLocked = True Then
> wscript.echo UserAccount.Name
> UserAccount.IsAccountLocked = False
> UserAccount.SetInfo
> Counter = Counter + 1
> End If
> Next
> If Counter >0 Then
> wscript.echo Counter & " user accounts were unlocked in the " &
> Domain.Name & " domain."
> Else
> wscript.echo "No user accounts in the " & Domain.Name & " domain were
> locked."
> End If
>
> --
> Richard McCall [MSFT]
>
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
> "Mark Warbeck" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Richard,
> >
> > Thanks for the quick response. I copied your code into a file with the

> .vbs
> > extention. I changed "Target_Domain_Name" to the name of my domain. I

get
> > the following error:
> >
> > Line: 11
> > Char: 11
> > Error: Object required: 'Response'
> > Code: 800A01A8
> > Source: Microsoft VBScript runtime error
> >
> > This KB article seems to apply but I don't understand it.
> >
> > http://support.microsoft.com/default...b;en-us;224422
> >
> > Thanks for any additional help.
> >
> > Mark
> >
> >
> > "Richard McCall [MSFT]" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > First I would find the cause and prevent it.
> > >
> > > Otherwise here us a sample script that shows how to unlock accounts
> > > Resetting All Locked-Out User Accounts for a Domain Using a VBScript

> > Active
> > > Server Page
> > >
> > > Dim Domain
> > > Dim UserAccount
> > > Dim Counter
> > > Dim DomainName
> > > Counter = 0
> > > DomainName = "Target_Domain_Name"
> > > Set Domain = GetObject("WinNT://" & DomainName)
> > > Domain.Filter = Array("User")
> > > For Each UserAccount In Domain
> > > If UserAccount.IsAccountLocked = True Then
> > > Response.Write UserAccount.Name
> > > UserAccount.IsAccountLocked = False
> > > UserAccount.SetInfo
> > > Counter = Counter + 1
> > > End If
> > > Next
> > > If Counter >0 Then
> > > Response.Write Counter & " user accounts were unlocked in the " &
> > > Domain.Name & " domain."
> > > Else
> > > Response.Write "No user accounts in the " & Domain.Name & " domain

> > were
> > > locked."
> > > End If
> > >
> > > --
> > > Richard McCall [MSFT]
> > >
> > > "This posting is provided "AS IS" with no warranties, and confers no
> > > rights."
> > > "Mark Warbeck" <(E-Mail Removed)> wrote in message
> > > news:%(E-Mail Removed)...
> > > > On occasion our Active Directory is attacked and hundreds of users

get
> > > > locked out. They don't like waiting 30 minutes for the lockout to

> > expire.
> > > Is
> > > > there a tool or script that will allow me to unlock all accounts at

> > once?
> > > > It's tedious to unlock them one by one.
> > > >
> > > > Thanks,
> > > > Mark
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linked Accounts: How to link multiple accounts to opportunites cjepp Microsoft Outlook BCM 2 6th Oct 2008 09:17 PM
Multiple email accounts to multiple PSTs or at least multiple Inbo =?Utf-8?B?SmVmZiBUaG9tYXM=?= Microsoft Outlook Discussion 1 7th May 2006 01:29 AM
Power Settings: Okay on Admin, Can't Change on User Accounts, Multiple Computers Sam Fertel Windows XP General 3 3rd Feb 2006 03:18 PM
Multiple User Accounts - redundant home page change warnings =?Utf-8?B?Z3Jnd2k=?= Spyware Discussion 3 27th Nov 2005 08:36 PM
Multiple Profiles, multiple accounts, multiple machine configuring? Sam Marrocco Microsoft Outlook 0 30th Dec 2003 03:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:44 PM.