我需要帮助在消息框中将卷$_.mountpoint
之后的输出排序。
if ((Get-Tpm).TPMReady -eq $true){
$tpminfo = Get-WmiObject -class Win32_Tpm -namespace root\CIMV2\Security\MicrosoftTpm
[string]$tpmversion = $tpminfo.PhysicalPresenceVersionInfo
[System.Windows.MessageBox]::Show( "TPM Enabled "+$lf+ $lf + "VOLUMES: $lf"+ `
(Get-BitLockerVolume |select-object mountpoint,VolumeStatus| `
ForEach-Object {$lf,$_.MountPoint, $_.VolumeStatus}))
} else {
[System.Windows.MessageBox]::Show( "TPM DISABLED "+$lf+ $lf + "VOLUMES: $lf"+ `
(Get-BitLockerVolume |select-object mountpoint,VolumeStatus| `
ForEach-Object {$lf,$_.MountPoint, $_.VolumeStatus}))
EXIT
}
感谢Mattias
答案 0 :(得分:0)
尝试使用插入换行的这种方式来代替:
[System.Windows.MessageBox]::Show( "TPM Enabled: $thing`r`nVolumes:$thing")
因此,在您的脚本中,我会这样做(未经测试):
[System.Windows.MessageBox]::Show( "TPM DISABLED`r`n`r`nVOLUMES: `r`n" +`
(Get-BitLockerVolume |select-object mountpoint,VolumeStatus |`
ForEach-Object {"`r`n" + $_.MountPoint + ": " + $_.VolumeStatus}))