FredM
2008-09-30 15:00:20 UTC
I have a drive mapped as T: that happens automatically when I log in.
When I try the following PowerShell script to unmap that drive,
Remove-PSDrive 'T' -WhatIf
I get an error saying:
Cannot find drive. A drive with name 'T' does not exist.
However, Get-PSDrive clearly shows that T does in fact exist, so I'm
mystified why one part of PowerShell (Get-PSDrive) can see the T drive but
the other side (Remove-PSDrive) cannot.
All of the following fail with the same error message:
Remove-PSDrive T -WhatIf
Remove-PSDrive -Name T -WhatIf
Remove-PSDrive -Name 'T' -WhatIf
Remove-PSDrive -LiteralName 'T' -WhatIf
Remove-PSDrive t -WhatIf
Remove-PSDrive -Name t -WhatIf
Remove-PSDrive -Name 't' -WhatIf
Remove-PSDrive -LiteralName 't' -WhatIf
What else can I try besides removing -WhatIf at the end? I don't want to
run this for real (without -WhatIf) until I know it has a real chance of
running.
When I try the following PowerShell script to unmap that drive,
Remove-PSDrive 'T' -WhatIf
I get an error saying:
Cannot find drive. A drive with name 'T' does not exist.
However, Get-PSDrive clearly shows that T does in fact exist, so I'm
mystified why one part of PowerShell (Get-PSDrive) can see the T drive but
the other side (Remove-PSDrive) cannot.
All of the following fail with the same error message:
Remove-PSDrive T -WhatIf
Remove-PSDrive -Name T -WhatIf
Remove-PSDrive -Name 'T' -WhatIf
Remove-PSDrive -LiteralName 'T' -WhatIf
Remove-PSDrive t -WhatIf
Remove-PSDrive -Name t -WhatIf
Remove-PSDrive -Name 't' -WhatIf
Remove-PSDrive -LiteralName 't' -WhatIf
What else can I try besides removing -WhatIf at the end? I don't want to
run this for real (without -WhatIf) until I know it has a real chance of
running.