My Profile Photo
name := "Graham Beer"

`Cloud Engineer with his head in the AWS clouds, authored chapters in the PowerShell Conference Book 1 & 2 and currently learning and enjoying Go


PowerShell Conf Book Planet PowerShell Top 50 PowerShell

ConfigMgr overview: quick view of servers and roles

If you have a reasonable sized Configuration Manager environment, then quickly displaying servers, with a list of roles installed and the number roles for each site is not easy.

This sort of information can be useful to your manager, a 3rd party coming in to do a review or walking into a new job. This script I created will display this information for you and quickly. Running the script has two options:

1. Get-CMSiteOverview : This will display all the data in the ‘SMS_SCI_SysResUse’ class  name, unformatted. This will give you the option to choose what you select by piping to a select-object, Where-object type filter.

1
(i.e. Get-CMSiteOverview | select NetworkOSPath, RoleName)

2. Get-CMSiteOverview -format : The ‘-format’ is a switch which will format the Servers, roles and role count in a table format for you. This is the quick no fuss approach to viewing your environment…quickly !

I hope you find this a useful tool to check out your environment.

function Get-CMSiteOverview {
param([Switch]$Format)
<#
.DESCRIPTION
Display all site details.
Use format switch to display data as table or leave off for 'raw' data to use a 'manual' Select statement
.EXAMPLES
Get-CMSiteOverview
Get-CMSiteOverview -format
Get-CMSiteOverview | select NetworkOSPath, RoleName
.CREATOR
Graham Beer
#>
#Set CIM search criteria
$SearchCritera = @{
Namespace = "{1}{0}" -f (Get-CimInstance -Namespace Root\SMS -ClassName SMS_ProviderLocation).SiteCode,"root\SMS\Site_"
ClassName = 'SMS_SCI_SysResUse'
}
#Collate site data
$Site = Get-CimInstance @SearchCritera
#Format switch for presentation
if($format) {
#set column for 'Format-Table' cmdlet
$column1 = @{expression={ "$($_.name -replace '\\',' ')`n`n" }; width=30; label="Server"; alignment="center"} #Server Names
$column2 = @{expression={ $_.Group -join ', ' }; width=150; label="Role Types"; alignment="left"} #Server Role Names
$column3 = @{expression="count"; width=25; label="Number of roles"; alignment="center"} #Count of Roles per site
#Display results
return $site | select -Property NetworkOSPath -ExpandProperty rolename |
group networkospath |
Format-Table -wrap $column1, $column2, $column3
}
#Display raw data
$site
}