# results from AD (bitlocker password key) no strings

**URL:** <https://forums.powershell.org/t/results-from-ad-bitlocker-password-key-no-strings/733>\
**Category:** PowerShell Help\
**Created:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/results-from-ad-bitlocker-password-key-no-strings/733 "2011-12-31T18:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![archives](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@archives](https://forums.powershell.org/u/archives)\
**Post date:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/results-from-ad-bitlocker-password-key-no-strings/733/1 "2011-12-31T18:30:00Z")

</div>

by peterhillnl at 2013-03-18 05:19:12

> Hi all,  
>   
> I am just beginnig to powershell script and have made some nice cut and past things so far but this next problem is   
> eating me up for more than a week now.  
>   
> the result of reading the key from active directory (computer) (msfve-recoverypassword ) is not editable like a string  
>   
> i’ve tried subtring and .replace and .tostring but nothing helps.   
> what i really want to do is read that key if one is stored in ad, and use it to enable bitlocker  
> on win7 pc’s that somhow have bitlocker disabled.  
> or even get a command that random gets a new key, enable bitlocker on c: and store that key in AD  
> but that i also can’t seem to get done 🙂  
>   
> with manage-bde -on c: -protectors i have to provide an -ID and i cant use the result **$code** because it has to much information.  
>   
>   
> `$computer = read-host "Enter computer name"$comp_dn = (get-adcomputer $computer).distinguishedname$code= get-adobject -filter ‘objectclass -eq "msFVE-RecoveryInformation"’ -searchbase $comp_dn -properties msfve-recoverypassword |sort whencreated | select msfve-recoverypassword -last 1Write-Host "Key in AD:$code" -ForegroundColor blue #(this shows a key but with some prefix i cant get rid off)`  
> Key in AD**]590458-125400-108845-562001-651563-090651-673etc**  
>   
>   
> **next i want to:  
> `Write-Host "Key in AD:$code" -ForegroundColor greencmd /c "c:\windows\sysnative\manage-bde.exe -cn $computer -on c: -adbackup -protectors "# cmd /c "c:\windows\sysnative\manage-bde.exe -cn $computer -status"`**  
>   
> **i hope u guys can help me see the light 🙂**  
>   
> **regards,**  
>   
> **peter (netherlands)**

by mjolinor at 2013-03-18 05:36:31

> See if this works better:  
>   
> `$computer = read-host "Enter computer name"$comp_dn = (get-adcomputer $computer).distinguishedname$code= get-adobject -filter 'objectclass -eq "msFVE-RecoveryInformation"' -searchbase $comp_dn -properties msfve-recoverypassword |sort whencreated | select -ExpandProperty msfve-recoverypassword -last 1Write-Host "Key in AD:$($code)" -ForegroundColor blue`

by peterhillnl at 2013-03-18 07:13:51

> Thanks Mjolinor, this works great!   
> Now for me to figure out why 😉  
>   
>   
> Manny thanks again. i’ll get right on it.

by mjolinor at 2013-03-18 07:17:02

> It’s the difference between the string value of an object with one property, and the string value of just that one property.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 9:02pm UTC](https://forums.powershell.org/t/results-from-ad-bitlocker-password-key-no-strings/733/2 "2024-05-16T21:02:38Z")

</div>

Closed on May 16, 2024, 9:02pm UTC


