Skip to content

Instantly share code, notes, and snippets.

@Graham-Beer
Created February 13, 2019 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Graham-Beer/59966395a77506d0675af0547a0e6f3e to your computer and use it in GitHub Desktop.
Save Graham-Beer/59966395a77506d0675af0547a0e6f3e to your computer and use it in GitHub Desktop.
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