Grid trying to format date and failing

Here is an interesting one. I am getting a computer’s bitlocker key to present to my techs.

$Bitlocker = Get-ADObject -Filter { objectclass -eq ‘msFVE-RecoveryInformation’ } -SearchBase $ADDN -Properties ‘msFVE-RecoveryPassword’ |
Select-Object “name”, ‘msFVE-RecoveryPassword’

The name on this returns data that looks like the following:

You can see it has a date/time and the GUID of the drive that was bitlockered. When getting the type it is returned as a string.

When trying to output this to a grid, though, I think UDGrid is detecting this as a potential system date/time and tries to convert it to a date/time string. This means I end up with “Invalid date” in the grid, instead of presenting the above information. I have tried to make sure I cast it as a string, put it in quotes, but still get the Invalid date.

Does anyone have any suggestions on how to prevent udgrid from trying to convert this to a date/time?

Hey @dkkazak are you making this information into a PS CUSTOM object before passing it to the grid?

Yes, here is what I do with it next:

    $BitlockerArray = @()
			foreach ($Key in $Bitlocker) {
				$NameOption = [string]$
				$BitlockerArray += [pscustomobject]@{
					Name = [string]"$NameOption"
					"msFVE-RecoveryPassword" = $Key."msFVE-RecoveryPassword"

$BitlockerArray | Out-UDGridData

ok so how important is the date part to this bitlocker information? I mean it may not be a true solution more of a work-around, but you tried stripping the date off of the front of it? So you just passing

into the grid…? Just also thinking about it…I havent done anything with Bitlocker…but in like an ISE or VScode what are all the properties of this Bitlocker is the name the best one to get the information you want? I’d either strip the date off, or look at the get-member or format-list the object to look at all possible data it returns…just my 2 pence worth :slight_smile:

1 Like

Yes @psDevUK, that is an excellent suggestion. I ended up taking the name field and splitting it so that I have the date in one column and the password ID (GUID) in a separate column now. I think that will improve readability anyway for techs.


1 Like