Sep 04 2020 08:33 AM
Hello I am trying to get a foreach loop to work but when I run the script the way it is in the below example it only runs against my local computer and not against the computers in computers.txt. Not sure what I am doing wrong. Any help is appreciated!!
$computers = get-content "C:\scripts\Bitlocker\computers.txt"
foreach ($computer in $computers) {
Enable-Bitlocker -MountPoint c: -UsedSpaceOnly -SkipHardwareTest -RecoveryPasswordProtector
$RecoveryKeyGUID = (Get-BitLockerVolume -MountPoint $env:SystemDrive).keyprotector | where {$_.Keyprotectortype -eq 'RecoveryPassword'} | Select-Object -ExpandProperty KeyProtectorID |manage-bde.exe -protectors $env:SystemDrive -adbackup -id $RecoveryKeyGUID}
Sep 04 2020 10:29 AM
SolutionSep 08 2020 05:33 AM
Sep 04 2020 10:29 AM
Solution