I’m trying to run a remote call to servers using Get-WindowsFeature and everything I see via Google searches shows that Get-WindowsFeature has a -computerName parameter, yet on my WMF 5.1 2008 R2 utility server, I only see a -Name parameter and that’s for the Role or feature I want information on.
NAME
Get-WindowsFeature
SYNOPSIS
The Get-WindowsFeature cmdlet allows you to retrieve information about
roles, role services, and features that are available on a computer that
is running Windows Server 2008 R2.
SYNTAX
Get-WindowsFeature [[-Name] ] [-logPath ] []
Not terribly useful is a local return:
Get-WindowsFeature -Name Web-Ftp-Server
Display Name Name
------------ ----
[ ] FTP Server Web-Ftp-Server
I was hoping to perhaps run Invoke-Command with this cmdlet to glean info on what’s installed on rmeote servers.
Alternately, I was thinking if I had a local text file that had listed the following Roles or features:
Web-Ftp-Server
Web-Ftp-Service
Web-Ftp-Ext
…if it could read from my utility server, then essentially query for those Feature Roles on my array of remote computers then return TRUE/FALSE.
This sounds tremendously useful but if the Cmdlet doesn’t exist yet, is there another way?
It’s not deprecated, but it’s changed over time. You can certainly use it with Invoke-Command. Note that the default “checkbox” display is just a display thing - the output is object-based, not text-based. If you pipe it to “Format-List -Prop *”, for example, you’ll get the “raw” output. One of the output properties is a True/False one that showed if it’s installed or not.
…but get the error “The term ‘Get-WindowsFeature’ is not recognized as the name of a cmdlet”.
I must be misunderstanding remoting even though I’ve read the freebie “Secrets to Powershell remoting”
I thought that if I had my Utility server with the latest PS cmdlets, I could leverage any of them to query against any server in the domain regardless if those remote servers only had PS 2.0 installed. Is this a mistaken assumption?
If so, then I’d have to update WMF on hundreds of server to get this kind of information about what’s installed on a remote server for example.
Nice, that worked thank you. What wasn’t intuitive to me was that the NoteProperty (PSComputerName) is found outside the curly braces, part of the Invoke-command cmdlet.
yet, the select -property is piped from the Get-WindowsFeature cmdlet inside the curly braces.
How is it that the parent NoteProperty can be selected/outputted inside the braces?
So the remote DC is running PS 2.0 and you’re right, servermanager wasn’t loaded, so I imported that module on the remote DC, confirmed it can run Get-WindowsFeature, then I go back to my scripting host and run your revised snippet and it still fails for those 2 DC’s.
The term 'Get-WindowsFeature' is not recognized as the name of a cmdlet
[ ed. This was addressed in another thread on how to use Import-Module ServerManager in an Invoke-Command statement]