The script generates a report containing computers and their Bitlocker status. To execute the script, create a report with the corresponding custom column. A scope is required for the report.
In the script, the $columnID varialbe specifies the identifier of the Boolean custom column that will contain Biltocker statuses. To get the identifier of a custom column:
- In the Report-specific columns section, on the Columns tab, right-click the custom column.
- In the context menu, navigate to Copy and click Column ID.
- The column identifier will be copied to clipboard.
PowerShell
$columnID = "{a72d4285-3013-42f0-b22b-5a942908ac1b}" # TODO: modify me
$bitlockerSearcher = New-Object Softerra.Adaxes.Adsi.Search.DirectorySearcher $NULL, $False
$bitlockerSearcher.VirtualRoot = $True
$bitlockerSearcher.SearchParameters.ReferralChasing = "ADS_CHASE_REFERRALS_NEVER"
$criteria = New-AdmCriteria msFVE-RecoveryInformation
$bitlockerSearcher.SearchParameters.Criteria = $criteria
$bitlockerSearcher.SearchParameters.PageSize = 500
$computerDNsWithBitlocker = New-Object "System.Collections.Generic.HashSet[System.String]"
try
{
$bitlockerIterator = $bitlockerSearcher.ExecuteSearch()
while ($Context.MoveNext($bitlockerIterator))
{
$bitlockerSearchResult = $bitlockerIterator.Current
$dn = New-Object "Softerra.Adaxes.Ldap.DN" $bitlockerSearchResult.AdsPath.DN
$computerDNsWithBitlocker.Add($dn.Parent)
}
}
finally
{
if ($bitlockerIterator) { $bitlockerIterator.Dispose() }
}
$criteria = New-AdmCriteria computer
$Context.DirectorySearcher.AddCriteria($criteria)
try
{
$searchIterator = $Context.DirectorySearcher.ExecuteSearch()
while ($Context.MoveNext($searchIterator))
{
$searchResult = $searchIterator.Current
$containsBitlocker = $computerDNsWithBitlocker.Contains($searchResult.AdsPath.DN)
$Context.Items.Add($searchResult, @{ $columnID = $containsBitlocker }, $NULL)
}
}
finally
{
if ($searchIterator) { $searchIterator.Dispose() }
}