none
powershell_Find installed features on many servers RRS feed

  • Question

  • Good day,

     I need to get the installed features of many servers ranging between 2008, 2008 R2, 2012, and 2012 R2. I know the following below will work. What I need is to have it reference a serverlist, then pipe those results of the servers in that list into a csv or txt file. Any help would be great, I am working on methods to do this on my end as well and will update if I make head way.

    PS C:\> Import-Module ServerManager
    PS C:\> Get-WindowsFeature | Where-Object {$_.Installed -match “True”} | Select-Object -Property Name  | Out-File C:\Temp\WindowsFeatures.txt


    If possible, to avoid polluted data, I would like to have it look for one feature "windows server backup". I know the get-windows feature windows server backup would work. I just need help compling it all together into a functioning script.
    Thursday, April 16, 2015 3:43 PM

Answers

  • Start by making sure you have PSRemoting set up to your servers. Grab a couple names from your Serverslist.txt file and follow the example below. Replace my Comp1 and Comp2 with the names you get from your text file. If this doesn't work, then you need to get PSRemoting to work before you make use of the Invoke-Command cmdlet. If it's not, then read the Secrets of PowerShell Remoting at http://powershell.org/wp/ebooks/.

    Invoke-Command -ComputerName Comp1,Comp2 -ScriptBlock {"ComputerName: $env:COMPUTERNAME"}
    By the way, when you get this thing running, you'll need to keep in mind that in 2012/2012R2, the feature name is Windows-Server-Backup and in 2008/2008R2 its name is Backup. We can help you with that, once you know if PSRemoting is available to you.


    Thursday, April 16, 2015 8:54 PM

All replies

  • Thursday, April 16, 2015 3:49 PM
  • Below is what I got written thus far, I know it will error out as it is but this is what I am trying to get.

    $allservers = gc Serverslist.txt

    Foreach ($a in $allservers) {

    Invoke....{

    Commands

    } >> $a.txt

    }

    get-windowsfeature windows-server-backup

    Out-File C:\Temp\WindowsFeatures.txt

    Thursday, April 16, 2015 4:13 PM
  • Start by making sure you have PSRemoting set up to your servers. Grab a couple names from your Serverslist.txt file and follow the example below. Replace my Comp1 and Comp2 with the names you get from your text file. If this doesn't work, then you need to get PSRemoting to work before you make use of the Invoke-Command cmdlet. If it's not, then read the Secrets of PowerShell Remoting at http://powershell.org/wp/ebooks/.

    Invoke-Command -ComputerName Comp1,Comp2 -ScriptBlock {"ComputerName: $env:COMPUTERNAME"}
    By the way, when you get this thing running, you'll need to keep in mind that in 2012/2012R2, the feature name is Windows-Server-Backup and in 2008/2008R2 its name is Backup. We can help you with that, once you know if PSRemoting is available to you.


    Thursday, April 16, 2015 8:54 PM