Created
February 13, 2019 17:19
-
-
Save Graham-Beer/59966395a77506d0675af0547a0e6f3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-BitLockerStatus { | |
[CmdletBinding()] | |
param ( | |
[Parameter(ValueFromPipeline)] | |
[Microsoft.ActiveDirectory.Management.ADComputer] $Computers, | |
[parameter(Mandatory)] | |
[pscredential] $Credential | |
) | |
process { | |
$sb = { | |
$Bitlocker = Get-BitLockerVolume -MountPoint "C:" | |
enum ChassisType { | |
Other = 1 | |
Unknown = 2 | |
Desktop = 3 | |
LowProfileDesktop = 4 | |
PizzaBox = 5 | |
MiniTower = 6 | |
Tower = 7 | |
Portable = 8 | |
Laptop = 9 | |
Notebook = 10 | |
HandHeld = 11 | |
DockingStation = 12 | |
AllinOne = 13 | |
SubNotebook = 14 | |
SpaceSaving = 15 | |
LunchBox = 16 | |
MainSystemChassis = 17 | |
ExpansionChassis = 18 | |
SubChassis = 19 | |
BusExpansionChassis = 20 | |
PeripheralChassis = 21 | |
StorageChassis = 22 | |
RackMountChassis = 23 | |
SealedCasePC = 24 | |
} | |
$params = @{ | |
ClassName = 'Win32_SystemEnclosure' | |
Namespace = 'root\CIMV2' | |
Property = 'ChassisTypes' | |
ErrorAction = 'SilentlyContinue' | |
} | |
$Type = [ChassisType](Get-CimInstance @params).ChassisTypes | |
[PSCustomObject]@{ | |
ComputerName = $Bitlocker.ComputerName | |
Status = $Bitlocker.ProtectionStatus | |
ChassisType = $Type | |
} | |
} | |
foreach ($Computer in $Computers) { | |
if ( Test-WSMan -ComputerName $Computer.name -ErrorAction SilentlyContinue) { | |
$params = @{ | |
ComputerName = $Computer.name | |
ScriptBlock = $sb | |
Credential = $Credential | |
} | |
$return = Invoke-Command @params | |
$return | Add-Member @{ DN = $Computer.DistinguishedName } -PassThru | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment