Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Check Bitlocker status of OS Disks
- $laptops = (Get-ADComputer -SearchBase 'OU=Laptops,OU=EMEA,dc=contoso,dc=com' -Filter '*' | Select -Exp Name)
- $Table = @()
- $Row = @{
- "LaptopName" = ""
- "OSdisk" = ""
- }
- Foreach($CN in $laptops)
- {
- $result = Invoke-expression "manage-bde -cn $CN -status c:"
- if(($result[13]) -and ($result[13].contains("On"))) {
- $Row.LaptopName=$CN
- $Row.OSdisk="Protected"
- $objRecord = New-Object PSObject -property $Row
- $Table += $objRecord
- }
- elseif(($result[13]) -and ($result[13].contains("Off"))) {
- $Row.LaptopName=$CN
- $Row.OSdisk="Not protected"
- $objRecord = New-Object PSObject -property $Row
- $Table += $objRecord
- }
- elseif(!$result[13]){
- if(Test-Connection -BufferSize 32 -Count 1 -ComputerName $CN -Quiet) {
- $Row.LaptopName=$CN
- $Row.OSdisk="Not isntalled"
- $objRecord = New-Object PSObject -property $Row
- $Table += $objRecord
- }
- else{
- $Row.LaptopName=$CN
- $Row.OSdisk="Machine off"
- $objRecord = New-Object PSObject -property $Row
- $Table += $objRecord
- }
- }
- }
- $Table | export-csv "C:\scripts\MBAMStatus.csv" -NoTypeInformation
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement