I have a network share that is accessible via unc path and I can also map it as a drive using NET USE in command prompt.
However I am writing a PowerShell script that will need to map this drive as part of it and I am having problems mapping it using the New-PSDrive cmdlet.
This is the syntax that I believe should work based on what I've read online:
New-PSDrive X -PSProvider FileSystem -Root \\webserver\Logs\ -Credential $webuser
However I am receiving the below error when trying to run the command:
The specified drive root "\\webserver\Logs\" either does not exist, or it is not a folder.
I have tried with/without quotes and have included or excluded the final "\" with no luck.
Does anyone have any suggestions as to what I may be doing wrong?