简体   繁体   中英

Running power shell on a remote VM

Say I have a got a virtual machine VM1 with windows server 2008 installed on it. So it probably has PowerShell 2.0 installed on it but I can install PowerShell version 3.0 if needed to solve this problem. Now say my machine is Windows 7 64 bit with SP 1, I want to execute a PowerShell script on my machine that opens the PowerShell (not literally opening the window) on VM1 and executes some commands on the PowerShell of that VM1. And I do have administrative login credentials for that VM1 and my machine (both).

How can something like this be achieved ?

Thanks

It will work the same on version 2 & version 3, but you must have PSRemoting enabled . Once that's done, you can use Enter-PSSession to access the remote system interactively (similar to sshing into a Linux box) or Invoke-Command to execute individual commands or scriptblocks remotely.

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