Script works in PowerShell ISE but not in regular PowerShell window
hello all!
i've got ps conundrum ponder. have following script lines:
write-host"check password complexity requirements:"-foregroundcolorblack-backgroundcolorwhite
write-host""
import-moduleactivedirectory
$passwordpolicy=get-adobject$rootdse.defaultnamingcontext -propertypwdproperties
$passwordpolicy|select@{n="policytype";e={"password"}},`
distinguishedname,`
@{n
="password complexity requirements";e={switch($_.pwdproperties) {
0{"passwords can simple , administrator account cannot locked out"}
1{"passwords must complex , administrator account cannot locked out"}
8{"passwords can simple, , administrator account can locked out"}
9{"passwords must complex, , administrator account can locked out"}
default{$_.pwdproperties}}}} |ft*-auto
when run code in ise, works great. returns value setting "1" gpo set to.
but, when run same code in elevated powershell prompt, following error:
any appreciated.
don't retire technet! - (don't give yet - 13,085+ strong , growing)
Windows Server > Windows PowerShell
Comments
Post a Comment