Link to home
Start Free TrialLog in
Avatar of Jerry Seinfield
Jerry SeinfieldFlag for United States of America

asked on

Powershell script to identify server roles for a farm of servers

Hello Experts,

I just wonder if you can provide me with a nice Powershell  script that exports into a CSV the FQDN of servers from a forest/domain and the server role as well of OS installed on each server. Please see example below

ServerFQDN                            Server role        OS                                   Forestname                domainname
server1.root.domainname    schema master  Windows 2003 R2          root.domainname      domainA
server2.domainname            dhcp server         Windows 2008              root.domainname      domainB
server3.domainname            DNS                      Windows 2008 R2
server4.domainname            Exchange             Windows 2012 R2
server5.domainname            File server            Windows 2012

The script should be able to read information from AD and all servers and/or discovery the server roles installed on each server that is part of that forest/domain

Any help is highly appreciated
ASKER CERTIFIED SOLUTION
Avatar of Mohammed Khawaja
Mohammed Khawaja
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
server1.root.domainname    schema master  Windows 2003 R2          root.domainname      
server2.domainname            dhcp server         Windows 2008              root.domainname      
server3.domainname            DNS                      Windows 2008 R2
server4.domainname            Exchange             Windows 2012 R2
server5.domainname            File server            Windows 2012


getting the operating system and whether or not it is a DC or not is trivial. How would one differentiate between a member server and a file server?  you can check the roles and see if dhcp and/or dns is installed.  (doesn't mean that it is active).  Exchange is an application that runs on the server it is not a role.
Avatar of Jerry Seinfield

ASKER

Any other suggestions from the Powershell team?
Avatar of compdigit44
compdigit44

I am not a powershell expert but I believe the following MS blog article will give you tell you how to get most of the information you are looking for..

http://blogs.technet.com/b/heyscriptingguy/archive/2010/07/19/hey-scripting-guy-how-can-i-use-windows-powershell-2-0-to-retrieve-information-about-domain-controllers.aspx

http://technet.microsoft.com/en-us/library/ee176825.aspx