Greeting!!!
Scenario 1) I am using Get-childitem command to get the files and folders from the specified path.
Get-ChildItem -path “C:\Users” -recurse -force
Above command is providing a satisfactory result. But, I am getting error in Scenario 2.
Scenario 2) I am using the above command with Invoke-Command and getting an undesired output.
Invoke-Command -computername “Mycomputer” -scriptblock{Get-ChildItem -path “C:\Users” -recurse -force}
My findings till now
When only using scenario 1, By default, the Get-ChildItem cmdlet displays symbolic links to directories found during recursion, but does not recurse into them.
When I am using the scenario 2, It is not following the Get-ChildItem this behavior and it is doing the recursion.