PowerShell Invoke-Command performance issue

白昼怎懂夜的黑 提交于 2019-12-24 15:47:54

问题


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:


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

convertfrom-csv (Invoke-Command -ComputerName someComputerName -ScriptBlock { ls C:\ | convertto-csv} -credential myUsername)


来源:https://stackoverflow.com/questions/19039422/powershell-invoke-command-performance-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!