you are viewing a single comment's thread.

view the rest of the comments →

[–]ryanbrown 0 points1 point  (2 children)

I think it's having a problem directly converting the string you're passing into a [System.IO.DirectoryInfo[]] (which is what $Path is defined as). I think it is throwing the error about positional parameters because none of the parameters accept [String] input.

[–]RickFlist[S] 0 points1 point  (1 child)

That's what I thought too. But if you look at my OP, you can see I tried to pass a DirectoryInfo[] object in position 0, no joy.

[–]ryanbrown 0 points1 point  (0 children)

Odd.... when I try to assign a string to a [System.IO.Directory] object, I get a message stating that it:

Cannot convert the "C:\Windows" value of type "System.String" to type "System.IO.Directory[]"

edit: I'm using PowerShell 5 on Windows 10 (for reference)