tag:blogger.com,1999:blog-1560489154258592116.post7680756996664638805..comments2023-08-06T19:21:18.646-07:00Comments on The Walking Dev: PowerShell Pitfalls (Non-Fatal Exceptions, Test-Path, Drives, Jobs)Andrehttp://www.blogger.com/profile/04428797982154265035noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-1560489154258592116.post-89190791422127856802013-07-02T10:45:19.674-07:002013-07-02T10:45:19.674-07:00$Drive = 'C'; if(-not (Get-PSDrive -Name $...$Drive = 'C'; if(-not (Get-PSDrive -Name $Drive -ea SilentlyContinue)) { "Drive ($Drive) Does not exist" } else { "Drive ($Drive) Exists" }<br /><br /><br />EBhttps://www.blogger.com/profile/12468964902945366023noreply@blogger.comtag:blogger.com,1999:blog-1560489154258592116.post-46517418395696130902013-05-30T00:02:48.480-07:002013-05-30T00:02:48.480-07:00Try using [System.IO.Directory]::Exists("C:\&...Try using [System.IO.Directory]::Exists("C:\") instead <br /><br />As in my post showing the problems with Test-Path, the .net version seems more reliableAndrehttps://www.blogger.com/profile/04428797982154265035noreply@blogger.comtag:blogger.com,1999:blog-1560489154258592116.post-59697411106437812592013-05-29T07:20:25.848-07:002013-05-29T07:20:25.848-07:00What an annoying problem.. lost hours because of t...What an annoying problem.. lost hours because of the invisible drive issue. Thanks for the post! :)<br /><br />Could you explain why the drive-letter becomes available if I check its existence?<br /><br />Example:<br /><br />Invoke DriveMounted:\test.exe<br />-> Not working<br /><br />If (DriveExistUsingJob(DriveMounted:\test.exe))<br />{ Invoke.. }<br />-> Workingchhhttps://www.blogger.com/profile/10321547851884748204noreply@blogger.com