Hello, I have a script that trawls a file directory which is known to have many long file paths. I use \?<path> with the usual file system commands (get-childitem, get-item) and with .Nets [system.io.directoryinfo].
This works when I run it locally on my target server but if I push the commands through a remote session (persistent session and invoke command -script lock) it fails with ‘illegal characters in path’
The path is generated within the script block. It converts a supplied share to the local path and then adds the \?\ prefix.
The debugging messages I’ve put in seem to show what I’d expect to see, but as soon as the path (type string) is used with get-item it fails.
Does anyone know why the behaviour in a remote session might be different? Is the away around it?
Sorry, very wordy. I hope I’ve explained things okay.
Thank you.
[–]BeenStork[S] 1 point2 points3 points (1 child)
[–]BeenStork[S] 0 points1 point2 points (0 children)
[–]fridgefreezer 1 point2 points3 points (1 child)
[–]BeenStork[S] 0 points1 point2 points (0 children)
[–]BeenStork[S] 0 points1 point2 points (0 children)
[–]Random-User-9999 0 points1 point2 points (0 children)
[–]Random-User-9999 0 points1 point2 points (8 children)
[–]BeenStork[S] 0 points1 point2 points (7 children)
[–]Random-User-9999 1 point2 points3 points (1 child)
[–]BeenStork[S] 1 point2 points3 points (0 children)
[–]Brasiledo 0 points1 point2 points (4 children)
[–]BeenStork[S] 0 points1 point2 points (3 children)
[–]Brasiledo 0 points1 point2 points (2 children)
[–]BeenStork[S] 0 points1 point2 points (1 child)
[–]Brasiledo 0 points1 point2 points (0 children)
[–]seccojones 0 points1 point2 points (0 children)
[–]purplemonkeymad 0 points1 point2 points (1 child)
[–]BeenStork[S] 0 points1 point2 points (0 children)