alex
alex

Reputation: 976

Get all the machines in sharepoint farm

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

Upvotes: 2

Views: 10387

Answers (1)

vonPryz
vonPryz

Reputation: 24081

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" }

Upvotes: 4

Related Questions