Export-BitlockerParams.ps1
something exciting
Some information about the exciting thing
Table of contents generated with markdown-toc
Script
#Requires -RunAsAdministrator
#Requires -Modules @{ModuleName="BitLocker";ModuleVersion="1.0.0.0"}
[CmdletBinding(
DefaultParameterSetName = "BitEncrypt",
SupportsShouldProcess = $True,
ConfirmImpact = 'High'
)]
param(
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
ValueFromPipelineByPropertyName = $True,
HelpMessage = "Please enter the ComputerName or Pipe in from another command.")]
[Alias('Hostname', 'cn')]
[string[]]$ComputerName
)
BEGIN {
}
PROCESS {
foreach ($Computer in $ComputerName) {
try {
$Volumes = Invoke-Command -ComputerName $computer { Get-Volume }
$TPMKey = Invoke-Command -computername $computer { (Get-BitLockerVolume).KeyProtector }
foreach ($Volume in $Volumes) {
$properties = @{ComputerName = $Computer
KeyProtectorType = $TPMKey.KeyProtectorType
KeyProtectorId = $TPMKey.KeyProtectorId
RecoveryPassword = $TPMKey.RecoveryPassword
}
}
}
catch {
Write-Verbose "Couldn't connect to $Computer"
foreach ($property in $properties) {
$properties = @{ComputerName = $Computer
KeyProtectorType = $TPMKey.KeyProtectorType
KeyProtectorId = $TPMKey.KeyProtectorId
RecoveryPassword = $TPMKey.RecoveryPassword
}
}
}
finally {
$obj = New-Object -TypeName PSObject -Property $properties
Write-Output $obj | Format-List -Property $obj.ComputerName, $obj.KeyProtectorId, $obj.RecoveryPassword
}
}
}
END {
}
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simple click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.