Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Setting PasswordHistoryLength in Powershell

$
0
0

Hello

I want to set "Enforce password history" as 5 days using PS on a stand-alone (not joined to a domain) Windows 7. But I got an error as below:

Exception setting "PasswordHistoryLength": "Exception from HRESULT: 0x8000500F"
At line:2 char:10
+ $account. <<<< PasswordHistoryLength = 5
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

Command:

$account = ([adsi]"WinNT://./TestUser")

$account.PasswordHistoryLength = 5

$account.psbase.commitchanges()

How can i set this property using PSv2.

Regards



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>