简体   繁体   中英

Similar to connecting to remote computer using WSManagement, how to do it through powershell terminal

I am connecting to the remote windows machine to execute powershell scripts using WSManagement method.I am creating a runspace using WSManagement ConnectionInfo object.Then using the runspace for the powershell object.Then using the powershell object I am invoking scripts with Powershell.Invoke() command.

How to do this through the powershell terminal?

I must be misunderstanding this, because it looks like you're asking for the Invoke-Command cmdlet, which is the first result you'd get in a "powershell remote" google search.

Invoke-Command -ComputerName server1 -ScriptBlock { get-disk }

Invoke-Command -ComputerName server1 -FilePath .\test.ps1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM