【发布时间】:2019-05-09 00:47:54
【问题描述】:
当我尝试输入以下脚本时,我希望在 CSV 中提交内存,但我只得到 Get-Volume 部分。
这是我的代码:
function Get-tid {
return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date)
}
Write-Output "$(Get-tid) Informationen från sökningen $dc" |
Out-File C:\logg\logg.csv -Append
Get-Volume |
select DriveLetter, Size, SizeRemaining,
@{e={$_.Size - $_.SizeRemaining};l="Använt"},
@{e={[Math]::Round(100 / ($_.Size / $_.SizeRemaining) )};l="Antal %"} |
Add-Content -Path C:\logg\logg.csv
Get-Counter ”\\$env:COMPUTERNAME\memory\% committed bytes in use” |
Export-Csv -Append -Path C:\logg\logg.csv -Force
【问题讨论】:
-
Get-Counter以当前语言环境返回项目。也许只需在 ISE 中运行Get-Counter即可在您的语言环境中找到准确的措辞。例如:在我的荷兰机器上,它被称为 "\geheugen\percentage toegewezen bytes in gebruik"
标签: powershell csv output