问题
Is pssession
the same as psexec
?
If I use new-pssession
to create a session to a remote PC, is it the same as using psexec
?
If we can use invoke-command -computername
to create a temporary session, what is the benefit using pssseion
to create a persistent connection?
Under what circumstances should I use new-pssession
?
回答1:
New-PSSession is used when you have multiple commands, or even a script, to be run against a remote machine. Invoke-Command and psexec both allow you to run a single command remotely, and though that command could execute a script, it's not necessarily the best tool for the job.
来源:https://stackoverflow.com/questions/23790493/is-new-pssession-the-same-as-psexec