次のスニペットを考えると
$drives = Get-PSDrive
foreach($drive in $drives)
{
Write-Host $drive.Name "`t" $drive.Root
Write-Host " - " $drive.Free "`t" $drive.PropertyDoesntExist
}
drive.Property DoestExist プロパティはありません... うーん... 存在しないので、エラーがスローされると予想されますが、代わりに null が返されます。
エラーまたは例外を取得するにはどうすればよいですか?
編集 - 悪い - 1 つの質問で 2 つの質問をしたので、1 つを別の質問に移動しました。