私のPowerShellスクリプトはどういうわけか、正しい値を見ず、スペースがしきい値以下であっても常に電子メールアドレスに報告します。powershell powershell -gtスクリプトが正しく動作しない場合は、常に上限値に設定してください
$PSEmailServer = 'spamtitan.domain.nl'
$username = [Environment]::UserName
$folderSizeOutput = "{0:N0}" -f ((Get-ChildItem C:\users\$username -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum/1MB)
$threshold = "4500"
$folderSizeOutput
if ($folderSizeOutput -gt "$threshold"){
Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "ser Profile Disk $username above threshold " -Body "User Profile folder size: $folderSizeOutput/5000 MB"
}
else {
Write-Host "under limit"
}
私はそれがに何か持って知っている: $ foldersizeoutput 原因を私はharddata $ foldersizeouput = 10、それは動作します...実際にどのようにすることができます動作します – IIIdefconIII