Powershell Get-Childitem behavior with variables
-
Two more tidbits.
This happens even when running as the system account. If I run an elevated command prompt and run
psexec.exe -i -s -accepteula powershell.exe
to get a PowerShell session as System, the behavior persists.I have found what appears to be a workaround: Use
-OutVariable foo
at the end of the command. This still lists all of the results ofGet-ChildItem
for me, but at least it did also store it in a variable. -
More information from experimenting.
Using Out-variable doesn't actually make much of a different. Error is still occurring (didn't notice it the first time).
Also, apparently the command with no variable is having access problems. Methinks now there's something screwy with this particular server.
-
That could be Eddie. I'm experimenting and checking behavior with some of these commands.
-
@eddiejennings said in Powershell Get-Childitem behavior with variables:
More information from experimenting.
Using Out-variable doesn't actually make much of a different. Error is still occurring (didn't notice it the first time).
Also, apparently the command with no variable is having access problems. Methinks now there's something screwy with this particular server.
Do you still get the access issues if you're running powershell as admin?
-
@dafyre said in Powershell Get-Childitem behavior with variables:
@eddiejennings said in Powershell Get-Childitem behavior with variables:
More information from experimenting.
Using Out-variable doesn't actually make much of a different. Error is still occurring (didn't notice it the first time).
Also, apparently the command with no variable is having access problems. Methinks now there's something screwy with this particular server.
Do you still get the access issues if you're running powershell as admin?
Yes. Logged in as the local administrator account, as well as running as admin (which is the only option for this account).
-
@eddiejennings I assume you also right clicked and selected to [run as administrator]?
My account is an admin also but if i don't do the above some things don't work. -
This is likely because "Documents and Settings" isnt a real folder, just a junction point since Windows 7/Server 2008. Same reason you usually cant open this folder in Explorer.
These shortcuts only exist for legacy Windows things to function. You wont find this fake folder in Windows 10. -
It probably has something to do with it being a junction point.
cmd /c "dir /al"
will show that its a junction point toC:\Users
-
@jmoore said in Powershell Get-Childitem behavior with variables:
@eddiejennings I assume you also right clicked and selected to [run as administrator]?
My account is an admin also but if i don't do the above some things don't work.I did.
-
Must've been that one server. Seems like it's running fine on another one.