troubleshooting Question

Get bitlocker keys remotely

Avatar of Brandon Mac
Brandon Mac asked on
Powershell* BitLockerNetworking
2 Comments1 Solution216 ViewsLast Modified:
Manage Bitlocker keys for enterprise network, gather the keys and log any computers offline that resulted in not getting bitlocker key for that computer

below script is not working correctly for multiple computers to be checked for online connectivity write log, get bitlocker or else write log stating computername of machine that is offline, I don't know where I went wrong with my function for the log because all thats happening is log file shows date time stamp and nothing else and I'm not getting any other keys

function log($string){
write-host $string
$timestamp =  (get-date -format dd-mm-yyyy) + "|" + (get-date -format HHMMsstt)
$computers = get-content -path '\\computername\c$\users\admin\desktop\scripts\Laptops.txt'
FOREACH($COMPUTER IN $COMPUTERS){
if(Test-Connection -ComputerName $computer -count 1 -quiet){

log "$computer is online getting bitlocker key"
manage-bde -protectors -get c: -computername $computer > "\\computername\c$\users\admin\desktop\bitlocker\$computer.txt"
}
else{
$logfile  = "\\computername\c$\users\admin\desktop\scripts\logs\devicesoffline.txt"
log "$computer is Offline"
$timestamp + " " + $string | out-file -FilePath $logfile -Append -force
      }

}
}
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros