Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Account Lockout Policy - Powershell cannot detect it

Closed Thread
 
Thread Tools Display Modes
Old 11-08-2007   #1 (permalink)
James
Guest


 

Account Lockout Policy - Powershell cannot detect it

Here is the script. I will explain more at the bottom of script.

=========
function display ($x)
{
## password lock out threshold
$pw_lockoutthreshold = $x.properties.lockoutthreshold

## Locked out observation in minutes
$pw_lockoutobservation= New-Object
System.TimeSpan([System.Math]::ABS($x.properties["lockoutobservationwindow"][0]))
$pw_lockoutobservation_minutes = $pw_lockoutobservation.totalseconds/60

## Reset Account lockout counter after
$pw_lockout_duration= New-Object
System.TimeSpan([System.Math]::ABS($x.properties["lockoutduration"][0]))
#$pw_lockout_duration= New-Object
System.TimeSpan($x.properties["lockoutduration"][0])

write-host "Lock Out Threshold: `t" $pw_lockoutthreshold " invalid logon
attempts"
write-host "Reset Account lockout counter after: `t"
$pw_lockoutobservation_minutes " minutes"

if ($pw_lockout_duration.TotalMinutes -gt 0 -and
$pw_lockout_duration.TotalMinutes -lt 99999)
{write-host "Account LockOut Duration: `t"
$pw_lockout_duration.TotalMinutes " minutes"}
else
{write-host "Account LockOut Duration: `t Administrator must manually
unlock locked accounts"}
}
}

cls
$current_dom =
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$root = $current_dom.GetDirectoryEntry()
## get the current domain account policy
$search = [System.DirectoryServices.DirectorySearcher]$root
$search.Filter = "(objectclass=*)"
$result = $search.FindOne()

## display domain policy
display $result
=========
It works fine under this situation :
Lock Out Threshold : 5
Reset Account lockout counter after 80 min
Account LockOut Duration 50 min

But if i set the domain security policy on Lock Out Threshold to 0, and
which the group policy "suggested* Reset Account lockout and ount LockOut
Duration = "not defined", the scripts still display the minutes in 80 and 50
mins respectively (they retain old values especaully when threshold set to
0).

How can i make the script to accept *latest* value ?









Old 11-08-2007   #2 (permalink)
RichS
Guest


 

RE: Account Lockout Policy - Powershell cannot detect it

Which GPO are you setting these in? The settings only work in a policy
linked at the Domain level. After changing the settings did you refresh the
policy? It can take 90 minutes +\- soemthing to refresh the policy on a
workstation

Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"James" wrote:
Quote:

> Here is the script. I will explain more at the bottom of script.
>
> =========
> function display ($x)
> {
> ## password lock out threshold
> $pw_lockoutthreshold = $x.properties.lockoutthreshold
>
> ## Locked out observation in minutes
> $pw_lockoutobservation= New-Object
> System.TimeSpan([System.Math]::ABS($x.properties["lockoutobservationwindow"][0]))
> $pw_lockoutobservation_minutes = $pw_lockoutobservation.totalseconds/60
>
> ## Reset Account lockout counter after
> $pw_lockout_duration= New-Object
> System.TimeSpan([System.Math]::ABS($x.properties["lockoutduration"][0]))
> #$pw_lockout_duration= New-Object
> System.TimeSpan($x.properties["lockoutduration"][0])
>
> write-host "Lock Out Threshold: `t" $pw_lockoutthreshold " invalid logon
> attempts"
> write-host "Reset Account lockout counter after: `t"
> $pw_lockoutobservation_minutes " minutes"
>
> if ($pw_lockout_duration.TotalMinutes -gt 0 -and
> $pw_lockout_duration.TotalMinutes -lt 99999)
> {write-host "Account LockOut Duration: `t"
> $pw_lockout_duration.TotalMinutes " minutes"}
> else
> {write-host "Account LockOut Duration: `t Administrator must manually
> unlock locked accounts"}
> }
> }
>
> cls
> $current_dom =
> [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
> $root = $current_dom.GetDirectoryEntry()
> ## get the current domain account policy
> $search = [System.DirectoryServices.DirectorySearcher]$root
> $search.Filter = "(objectclass=*)"
> $result = $search.FindOne()
>
> ## display domain policy
> display $result
> =========
> It works fine under this situation :
> Lock Out Threshold : 5
> Reset Account lockout counter after 80 min
> Account LockOut Duration 50 min
>
> But if i set the domain security policy on Lock Out Threshold to 0, and
> which the group policy "suggested* Reset Account lockout and ount LockOut
> Duration = "not defined", the scripts still display the minutes in 80 and 50
> mins respectively (they retain old values especaully when threshold set to
> 0).
>
> How can i make the script to accept *latest* value ?
>
>
>
>
>
>
>
>
>
>
Old 11-10-2007   #3 (permalink)
James
Guest


 

Re: Account Lockout Policy - Powershell cannot detect it

gpupdate /force at Domain controller
gpupdate /force at workstation immediately



"RichS" <RichS@xxxxxx> wrote in message
news:4A089E59-D71F-4F26-8429-96FA30038B7A@xxxxxx
Quote:

> Which GPO are you setting these in? The settings only work in a policy
> linked at the Domain level. After changing the settings did you refresh
> the
> policy? It can take 90 minutes +\- soemthing to refresh the policy on a
> workstation
>
> Richard Siddaway
> Please note that all scripts are supplied "as is" and with no warranty
> Blog: http://richardsiddaway.spaces.live.com/
> PowerShell User Group: http://www.get-psuguk.org.uk
>
>
> "James" wrote:
>
Quote:

>> Here is the script. I will explain more at the bottom of script.
>>
>> =========
>> function display ($x)
>> {
>> ## password lock out threshold
>> $pw_lockoutthreshold = $x.properties.lockoutthreshold
>>
>> ## Locked out observation in minutes
>> $pw_lockoutobservation= New-Object
>> System.TimeSpan([System.Math]::ABS($x.properties["lockoutobservationwindow"][0]))
>> $pw_lockoutobservation_minutes = $pw_lockoutobservation.totalseconds/60
>>
>> ## Reset Account lockout counter after
>> $pw_lockout_duration= New-Object
>> System.TimeSpan([System.Math]::ABS($x.properties["lockoutduration"][0]))
>> #$pw_lockout_duration= New-Object
>> System.TimeSpan($x.properties["lockoutduration"][0])
>>
>> write-host "Lock Out Threshold: `t" $pw_lockoutthreshold " invalid logon
>> attempts"
>> write-host "Reset Account lockout counter after: `t"
>> $pw_lockoutobservation_minutes " minutes"
>>
>> if ($pw_lockout_duration.TotalMinutes -gt 0 -and
>> $pw_lockout_duration.TotalMinutes -lt 99999)
>> {write-host "Account LockOut Duration: `t"
>> $pw_lockout_duration.TotalMinutes " minutes"}
>> else
>> {write-host "Account LockOut Duration: `t Administrator must manually
>> unlock locked accounts"}
>> }
>> }
>>
>> cls
>> $current_dom =
>> [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
>> $root = $current_dom.GetDirectoryEntry()
>> ## get the current domain account policy
>> $search = [System.DirectoryServices.DirectorySearcher]$root
>> $search.Filter = "(objectclass=*)"
>> $result = $search.FindOne()
>>
>> ## display domain policy
>> display $result
>> =========
>> It works fine under this situation :
>> Lock Out Threshold : 5
>> Reset Account lockout counter after 80 min
>> Account LockOut Duration 50 min
>>
>> But if i set the domain security policy on Lock Out Threshold to 0, and
>> which the group policy "suggested* Reset Account lockout and ount
>> LockOut
>> Duration = "not defined", the scripts still display the minutes in 80 and
>> 50
>> mins respectively (they retain old values especaully when threshold set
>> to
>> 0).
>>
>> How can i make the script to accept *latest* value ?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

Old 11-13-2007   #4 (permalink)
IT Staff
Guest


 

Re: Account Lockout Policy - Powershell cannot detect it

i ran the script at xp workstations and still gives same results .

Shld the script be ran at DC ?


"James" <jkklim@xxxxxx> wrote in message
news:On919F5IIHA.6108@xxxxxx
Quote:

> gpupdate /force at Domain controller
> gpupdate /force at workstation immediately
>
>
>
> "RichS" <RichS@xxxxxx> wrote in message
> news:4A089E59-D71F-4F26-8429-96FA30038B7A@xxxxxx
Quote:

>> Which GPO are you setting these in? The settings only work in a policy
>> linked at the Domain level. After changing the settings did you refresh
>> the
>> policy? It can take 90 minutes +\- soemthing to refresh the policy on a
>> workstation
>>
>> Richard Siddaway
>> Please note that all scripts are supplied "as is" and with no warranty
>> Blog: http://richardsiddaway.spaces.live.com/
>> PowerShell User Group: http://www.get-psuguk.org.uk
>>
>>
>> "James" wrote:
>>
Quote:

>>> Here is the script. I will explain more at the bottom of script.
>>>
>>> =========
>>> function display ($x)
>>> {
>>> ## password lock out threshold
>>> $pw_lockoutthreshold = $x.properties.lockoutthreshold
>>>
>>> ## Locked out observation in minutes
>>> $pw_lockoutobservation= New-Object
>>> System.TimeSpan([System.Math]::ABS($x.properties["lockoutobservationwindow"][0]))
>>> $pw_lockoutobservation_minutes = $pw_lockoutobservation.totalseconds/60
>>>
>>> ## Reset Account lockout counter after
>>> $pw_lockout_duration= New-Object
>>> System.TimeSpan([System.Math]::ABS($x.properties["lockoutduration"][0]))
>>> #$pw_lockout_duration= New-Object
>>> System.TimeSpan($x.properties["lockoutduration"][0])
>>>
>>> write-host "Lock Out Threshold: `t" $pw_lockoutthreshold " invalid logon
>>> attempts"
>>> write-host "Reset Account lockout counter after: `t"
>>> $pw_lockoutobservation_minutes " minutes"
>>>
>>> if ($pw_lockout_duration.TotalMinutes -gt 0 -and
>>> $pw_lockout_duration.TotalMinutes -lt 99999)
>>> {write-host "Account LockOut Duration: `t"
>>> $pw_lockout_duration.TotalMinutes " minutes"}
>>> else
>>> {write-host "Account LockOut Duration: `t Administrator must manually
>>> unlock locked accounts"}
>>> }
>>> }
>>>
>>> cls
>>> $current_dom =
>>> [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
>>> $root = $current_dom.GetDirectoryEntry()
>>> ## get the current domain account policy
>>> $search = [System.DirectoryServices.DirectorySearcher]$root
>>> $search.Filter = "(objectclass=*)"
>>> $result = $search.FindOne()
>>>
>>> ## display domain policy
>>> display $result
>>> =========
>>> It works fine under this situation :
>>> Lock Out Threshold : 5
>>> Reset Account lockout counter after 80 min
>>> Account LockOut Duration 50 min
>>>
>>> But if i set the domain security policy on Lock Out Threshold to 0, and
>>> which the group policy "suggested* Reset Account lockout and ount
>>> LockOut
>>> Duration = "not defined", the scripts still display the minutes in 80
>>> and 50
>>> mins respectively (they retain old values especaully when threshold set
>>> to
>>> 0).
>>>
>>> How can i make the script to accept *latest* value ?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>
>

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Admin Account Lockout EricLoadwick Vista account administration 8 3 Weeks Ago 01:48 PM
Novell Client for Vista account lockout problem tandrist Vista networking & sharing 0 03-04-2008 07:17 AM
vista password change account lockout Bob Moore Vista networking & sharing 0 06-20-2007 12:38 PM
Vista caching passwords causes domain account lockout... putt454@yahoo.com Vista networking & sharing 5 05-17-2007 01:09 PM
set Account Lockout policy with Vista Home Premium: how? mikk Vista security 3 03-22-2007 10:42 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50