How To: List all servers used by your ConfigMgr Infrastructure

Here’s a quick PowerShell script to show all servers used in your ConfigMgr Hierarchy:

$myServers  = get-wmiobject  SMS_SystemResourceList `
   -namespace root\sms\site_LAB –computer LABServer
$myServers | select-object servername -unique `
   | sort Servername | out-gridview

You can alter that script a little to show all Roles for each server:

$myServers  = get-wmiobject  SMS_SystemResourceList `
    -namespace root\sms\site_LAB –computer LABServer
$myServers | select-object servername, RoleName  `
    | sort Servername | out-gridview

To run these in your environment, launch in PowerShell with proper rights to query your hierarchy, and replace “LAB” with your Central site ConfigMgr Site Code, and replace LABServer with your Central site server name.

Happy Scripting,

Greg

ramseyg@hotmail.com

About Greg Ramsey
Greg Ramsey is a Senior Distinguished Engineer for Dell Digital - Services. He has a B.S. in Computer Sciences and Engineering from The Ohio State University and has co-authored many books over the years. Greg is also a board member of the Northwest System Center User Group and the Midwest Management Summit. ​Greg has been a Microsoft Endpoint Manager (ConfigMgr, Intune) MVP for over 18 years.

Leave a comment