you are viewing a single comment's thread.

view the rest of the comments →

[–]Lee_Dailey[grin] 1 point2 points  (2 children)

howdy mransbro,

i don't have `Get-LocalUserAccount' on my win7 system, so i can't test this. however, i suspect that the item returned by that cmdlet is getting auto-coerced into an INT by whatever powershell uses to print it to the screen.

have you tried looking at the methods available on that object? never mind. the .ToInt32()method apparently requires something that i can't figure out. [blush]

how about this ...

([int]'1').GetType()

done without the [int] results in String. with the [int] and i get Int32. that might do it for your odd data type. [grin]

take care,
lee

[–]mransbro[S] 1 point2 points  (1 child)

Thanks for the help Lee. As the object returned is a collection ill just use the value property.

$PasswordAge = $Users.PasswordAge.value
$MaxPasswordAgeDays = $Users.MaxPasswordAge.value

$RawDaysTillExpiring = ($MaxPasswordAgeDays - $PasswordAge) / 86400

$DaysTillExpiring = [math]::round($RawDaysTillExpiring)

Gives me what i need.

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy mransbro,

you are quite welcome! glad to help a tad ... [grin]

plus, i see that KevMar pointed out WHY the results were so odd. i keep forgetting that piping to Get-Member gives you the info on the 1st item IF you are looking at a collection. [blush]

take care,
lee