question

PaulH-0073 avatar image
0 Votes"
PaulH-0073 asked LimitlessTechnology-2700 answered

Get-ADUser -filter * -properties logonhours to output with days and times?

Good Morning,

I am trying to get a powershell script to output usernames and allowed logon times that is useable. I can get an output but the time/date is in system.byte. This is what I am using:

Get-ADUser -filter * -properties LogonHours | export-csv -path (file path)

It spits out a CSV no problem but the logon data is in system.byte. That is my question...What do I need to do to convert it to days and times?

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cooldadtx avatar image
0 Votes"
cooldadtx answered

It's encoded. Here's a blog article on how to decrypt it with a PS helper script.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hello @PaulH-0073

This is an example on how to convert the bytes array to String:

https://social.technet.microsoft.com/wiki/contents/articles/24594.powershell-convert-the-bytes-array-to-string.aspx

Hope this is useful,
Best regards,

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.