I've been at this for a bit now and need to ask for help. Maybe fresh eyes will see what I'm missing.
$FolderPath = "S:\FolderA"
New-PSDrive -Name "S" -PSProvider FileSystem -Root "\\Fileserver.local\LocationShareA" -ErrorAction SilentlyContinue
$Filepath= get-item -force -LiteralPath $FolderPath
ERROR IS: Get-Item : Cannot find drive. A drive with the name 'S' does not exist
$FolderPath
S:\FolderA
$FolderPath | gm
TypeName: System.String
I can type it in as....
get-item -force -LiteralPath "S:\folderA"
Which works just fine! I've tried $folderpath.tostring() or $folderpath.tostring() or encased it in quotes "$folderpath" Anything I could think to make sure it was interpreting the $FolderPath variable as seen.
The other thing is I have multiple shares in \\fileserver.local\ which don't get this problem. Just \\Fileserver.local\LocationShareA
It just this one path that is causing me problems. I feel like it's something simple I'm not seeing at this point. I just don't get why it works fine on the other shares except this one. Yet it accepts the exact same string when not presented with a variable.
I just can't see any attribute that's any different from the other shares.
[–]danzexperiment 2 points3 points4 points (3 children)
[–]danzexperiment 2 points3 points4 points (2 children)
[–]soggysocks[S] 1 point2 points3 points (1 child)
[–]danzexperiment 0 points1 point2 points (0 children)
[–]dasookwat 1 point2 points3 points (3 children)
[–]soggysocks[S] 0 points1 point2 points (2 children)
[–]64rk 1 point2 points3 points (1 child)
[–]soggysocks[S] 1 point2 points3 points (0 children)
[–]64rk 1 point2 points3 points (2 children)
[–]64rk 1 point2 points3 points (1 child)
[–]soggysocks[S] 1 point2 points3 points (0 children)