1

There are a few computers on my domain that I have access to remote into with PowerShell. I'm getting extremely slow performance when I remote into a particular computer with a command like this:

Invoke-Command -ComputerName someComputerName -ScriptBlock { ls C:\ } -credential myUsername

It takes about 10 seconds to display each file/folder on the drive. If I run the same command from within a session using Enter-PSSession then there are no performance issues. Also if I run a command like Get-Alias with Invoke-Command there are no performance issues. Lastly I can run any command on any other computer without any performance issues.

Any idea what could be causing this? Thanks!

1 Answer 1

2

Could be a bandwidth issue. Does this run any faster?

convertfrom-csv (Invoke-Command -ComputerName someComputerName -ScriptBlock { ls C:\ | convertto-csv} -credential myUsername)
Sign up to request clarification or add additional context in comments.

2 Comments

Yes that command runs almost instantly. Is this faster because the csv representation of these files is much smaller than the object representation? Any idea what could be causing a bandwidth issues like this? Thanks!
Yes, the XML payload for that csv is much smaller than the XML payload for the FileInfo objects. You can verify this yourself by using export-clixml on both, and noting the file sizes. You might want to fire up a packet analyzer to see what's going on with the network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.