現在、私のログ機能は情報を単一の列に吐き出し、読みにくいです。各(DisplayName、PoolName、PoolSnapshot、DesktopSVIVmSnapshot)とそれぞれの情報が正しく配置されている別々の列に分割する方法はありますか?PowerShellログ機能の可読性
function log ([string]$entry) {
Write-Output $entry | Out-File -Append "C:\logs\SNAPSHOT.csv"
}
Add-PSSnapin Quest.ActiveRoles.ADManagement
$date = Get-Date -Format "MM-dd-yyyy"
$time = Get-Date -Format "hh:mm:sstt"
# begin log
log $(Get-Date)
log "The below Desktops are not using the correct Snapshot."
if (@($DesktopExceptions).Count -lt 1) {
Write-Output "All desktops in $pool are currently using the correct snapshots." |
Out-File -Append "C:\logs\SNAPSHOT.csv"
} else {
Write-Output $DesktopExceptions |
Select-Object DisplayName,PoolName,PoolSnapshot,DesktopSVIVmSnapshot |
sort DisplayName |
Out-File -Append "C:\logs\SNAPSHOT.csv"
}
log $(Get-Date)
09/11/2017 12:16:17 DisplayName PoolName PoolSnapshot DesktopSVIVmSnapshot ----------- -------- ------------ -------------------- xxxc-13v xxxc-xxx /8-11-2017/09-07-2017 /8-11-2017 xxxc-15v xxxc-xxx /8-11-2017/09-07-2017 /8-11-2017 xxxc-1v xxxc-xxx /8-11-2017/09-07-2017 /8-11-2017 xxxc-20v xxxc-xxx /8-11-2017/09-07-2017 /8-11-2017
注:私はポストに長いをしないために期待してのログの一部を削除しました。