Get all the machines in sharepoint farm

10,329

If Get-SPDatabase | Select NormalizedDataSource returns all the databases, you can filter the results by using the -Unique switch:

Get-SPDatabase | Select NormalizedDataSource -unique

You can get all the SP application servers by filtering by role:

get-spserver | ? { $_.Role -eq "Application" }
Share:
10,329
alex
Author by

alex

software architect sharepoint ibm websphere MQ ibm datapower Oracle weblogic server

Updated on June 23, 2022

Comments

  • alex
    alex over 1 year

    im writing really big script that will get a lot of info on the farm I want to make it dynamically so I want :
    1. Get all the database servers in the sharepoint farm 2. And I want to get all the sharepoint machines in farm

    The problem is that with

    Get-SPServer

    I get all the server together mixed up and I get the smtp server as well And with

    Get-SPDatabase | Select NormalizedDataSource

    I get them multiple times

    Please help

    • Andy Arismendi
      Andy Arismendi almost 12 years
      What order do you want to the objects from Get-SPServer to be in?
    • alex
      alex almost 12 years
      i dont care . do you know a way how to parse them ?
    • Andy Arismendi
      Andy Arismendi almost 12 years
      It sounds like what you want to do is sort the objects returned by Get-SPServer and possibly filter some objects out as well. To sort by object properties you can use the Sort-Ojbect cmdlet and to filter out specific objects use the Where-Object cmdlet.