We all know that we can install Powershell v3.0 (maybe also v4.0 - didn’t test yet) on Win7. But there are a lot of modules missing compared to v3.0 on Win8.
This is what I would like to achieve:
Get a Win8/Win8.1/WS2012/WS2012R2 machine, which will have either PS 3.0 or 4.0 preinstalled and run commands from there against other WS2008R2 machines.
Are those commands going to be executed successfully?
Example: Add-Printer -Computername “MyWS2008R2” -Port … –> is the printer going to be created? (the PrintManagement module is not available under PS 3.0 Win7)
Unfortunately, no, they won’t work that way. The new OS cmdlets you’re referring to are all CIM-based cmdlets; they rely on the presence of new WMI namespaces and classes which don’t exist on operating systems prior to Windows 8 / Server 2012.
You have to differentiate between what is shipped as part of PowerShell (actually Windows Management Framework - PowerShell is becoming a smaller and smaller part of WMF over time) and what ships as part of the OS. When Windows 8 first appeared I did a comparison between the modules available on Windows 8 and those available on Windows 7 with WMF 3 installed. The results can be seen here http://msmvps.com/blogs/richardsiddaway/archive/2012/12/14/powershell-v3-installed-modules.aspx
The same comparison holds true for Windows 8.1 and WMF on legacy OS
The reason you can’t, and won’t, get the extra modules on Windows 7 /2008/2008 R2 is that they are CDXML modules - PowerShell modules created directly from CIM (WMI) classes. The required classes aren’t available on anything earlier than Windows 8 and won’t be ported back to those earlier versions of Windows.
The good news is that the new CIM classes duplicate a lot of functionality available in CIM classes available in root\cimv2. The bad news is that you’ll have to write your own CDXML modules or PowerShell functions to use them. PowerShell and WMI - PowerShell and WMI - covers using a lot of those classes
Guys, I like your fast reponse time and willingness to help. I was upset to hear that I won’t be able to use PS 4.0 from a Win8.1 PC and can’t create remotely printers on a Windows Server 2008R2 machine.
Still, I managed to get my hands on a Win8.1 PC and played a little with the Printer cmd-lets (Get-Printer, Set-Printer, Add-Printer).
So, what do you think? All these commands ran successfully when executed against the WS2008R2 server.
I was able to retrieve the current printer list, change their settings and add new printers. So, it works after all!
This is one of the commands I ran:
Add-Printer -Name Testprinter -Computername MyServer2008R2 -Portname Testport -Drivername “HP Universal Printing PCL 6” -Shared -Sharename Testprinter
Again: I ran the command on a Win8.1 (with PS 4.0) PC and the printer was created successfully on a Windows Server 2008 R2 (with PS 2.0).
I thought I should share this precious info with you!
Well that’s unexpected. Maybe those particular cmdlets are working with the old Win32_Printer class in the Cimv2 namespace, instead of having new CIM classes defined like so many of the other Windows 8 cmdlets.