简体   繁体   中英

Powershell 4 compatibility with Windows 2008 r2

In my environment I have a single server that has access to pretty much my entire network. That server is running Windows 2008 r2, and I have upgraded Powershell to version 4.0. The question I have is this... Can I run cmdlets from that machine on other machines that are version 4 specific?

For instance, when I am using Powershell, even though it is version 4, it doesn't give me an intellisense autocomplete for "Get-Volume" like it would on a 2012 r2 machine. I understand that it won't run on that machine because the infrastructure won't allow for it, but what about a 2012 r2 machine remotely?

I am looking to run batch scripts from there for various purposes.

Get-Volume in your example is available only on Windows Server 2012 and above. So, it won't auto-complete on a 2008 R2 system. You can use PowerShell implict remoting .

Using implict remoting, you can import all cmdlets from a remote system into a local session and use them as if they are available on the local system.

First, this is probably a ServerFault-question as it's related to server-administration.

PowerShell 4.0 installed on 2008 R2 can't run 2012 cmdlets on a 2012 R2-machine like Get-Volume -ComputerName My2012Server , because the cmdlets doesn't exist on your 2008 R2 machine. However, you should be able to invoke the cmdlet on the 2012 R2-server, like:

Invoke-Command -ComputerName My2012Server -Scriptblock { Get-Volume }

Be aware that you would not get autocomplete support when writing it as the commands and help files aren't installed on your 2008 R2-server

Import-PSSession is also a possibility if your gonna run the commands interactively. For a script I would probably still use Invoke-Command .

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