I am writing a script to export all computer LAPS ms-Mcs-AdmPwd values to KeePass to allow historical logging.
I have a few machines for whatever reason a few objects have no password set. However I am getting a value back. It is not $null or "".
$LAPSPWD = Get-AdmPwdPassword ServerName
Write-Host $LAPSPWD.password
$LAPSPWD -eq $null
$LAPSPWD -eq ""
When running this I get two false responses.
How do I determine what is being returned, so I can make it an IF statement exception to handle further processing?
I get the same response if I use the LAPS PS module (Example Above) or Query the directory(Example Below)
$computer = Get-ADComputer -Identity ServerName -SearchBase $dn -Property name,ms-Mcs-AdmPwd,CanonicalName
$LAPSpwd= $computer.'ms-Mcs-AdmPwd'
To add to this I tried to Measure-Object, and all came back with ZERO
Measure-Object $LAPSPWD | measure -Line -Character -Word
Lines Words Characters Property
----- ----- ---------- --------
0 0 0
Thanks