$Computers = get-content "C:\ADMIN\SCRIPTS\BITLOCKER\LAPTOPS.txt"
foreach($Computer in $Computers)
{
if (Test-Connection -Cn $Computer -BufferSize 16 -Count 1 -ea 0 -quiet)
{
$bitID = manage-bde -protectors -get c: -Type recoverypassword -cn $Computer | findstr /i /r /c:"{*}"
if (-not ([string]::IsNullOrEmpty($bitID)))
{
$GUID = $bitID.Trim() -replace 'ID: ',''
$pc = Get-ADComputer $Computer
$dn = $pc.DistinguishedName
$ldPath = "AD:\",$dn -join ""
$ldObj = Get-ChildItem $ldPath | where {$_.objectClass -eq "msFVE-RecoveryInformation" }
#write-host $Computer' : '$GUID' - '$ldObj
$backupResult = manage-bde -protectors -adbackup -cn $Computer c: -id $GUID
write-host $Computer' : BITLOCKER ACTIVE '$GUID' - '$backupResult
}
else
{
write-host $Computer' : NO BITLOCKER'
}
}
else
{
write-host $Computer' : UNREACHABLE'
}
}
I expect it to automatically enable bitlockker on all devices connected in active directory but instead it returns an error saying
path not found
$Computers = get-content "C:\ADMIN\SCRIPTS\BITLOCKER\LAPTOPS.txt"
this path...