Hi
Using PS 4.O. I am using a mapped ‘home’ drive (T:) to store my scripts so that they are backed up nightly. When I set my default location to this drive using Set-Location T:\Scripts cmdlet I get the following:
Set-Location : Cannot find path ‘T:\Scripts’ because it does not exist.
At C:\Users\Tony.Wainwright\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1:1 char:1
+ Set-Location T:\Scripts
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (T:\Scripts:String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
Looking through the help I have found the New-PSDrive cmdlet this sorts out my problem:
New-PSDrive -Name T -PSProvider FileSystem -Root “\\Lincoln\Data\Tony Wainwright”
Set-Location T:\Scripts
However this now shows the output of the New-PSDrive. Is there a way I can pipe the New-PSDrive to Set-Location?
Thanks
Tony