I used pushd \\network\drive\path
to move into this drive in powershell. Then I used Get-ChildItem
to check to which folders I can move from here. Unfortunately the results of this command is empty, while there is a lot of folders on my drive. What is the reason? I ran Powershell as administrator, without administrator rule there is no problem
1 Answer
This is not working because your administrator user lacks the privileges to view the content of the folder on this network share.
This is explained by the simple reason that it works without administrator, but not while using powershell as administrator.
I have confirmed this by making an alteration to one of my network shares. My user has rights but the user Administrator does not. I can view it the folder using pushd and dir as normal user, but not as admin. (and yes, dir is an alias for get-childitem)
-Force
is necessary?pwd
are you actually in the directory you think you are?pushd
command DOES NOT change your filesystem location. all it does isadds ("pushes") the current location onto a location stack
. ///// [2] the correct "change dir" command isSet-Location
. ///// [3] you really otta always use the-Path
or-LiteralPath
parameters withGet-ChildItem
... it is far safer AND easier to debug.