Melbourne, Australia
To be provided
Use Contact to message

SCCM Documentation – Site Configuration – Site Roles

Harmik Batth Tech's Blog

SCCM Documentation – Site Configuration – Site Roles

Now Site Roles, have a read on Microsoft Docs about the Site roles

“Configuration Manager uses site system roles to support management operations at each site. When you install a Configuration Manager site, some site system roles are automatically installed and assigned to the server on which Configuration Manager Setup has run successfully. One of these site system roles is the site server, which you cannot transfer to another server or remove without uninstalling the site. You can use other servers to run additional site system roles or to transfer some site system roles from the site server by installing and configuring Configuration Manager site system servers.

Each site system role supports different management functions.” 1

Purpose is to document what’s in the “Servers and Site System Roles”

SCCM-GetSiteRoles.png

Lets Get the Servers section first. To do that run following script

#clear Screen
cls

#Get SCCM sites
$CMSites = Get-CMSite

#Decalre Arrary to store values
$SiteServersTable  = @()

ForEach($CMSite in $CMSites)
{
$SiteServers = Get-CMSiteSystemServer -SiteCode $CMSite.SiteCode
ForEach ($SiteServer in $SiteServers)
{
$CMSiteCode = $CMSite.SiteCode
$SiteServerName = ($SiteServer.NALPath).ToString().Split(‘\\’)[2]
$SiteServerRoleCount = $SiteServer.RoleCount
Switch($SiteServer.Type)
{
1 {$SiteServerType = “Secondary”}
2 {$SiteServerType = “Primary”}
3 {$SiteServerType = “Child Primary”}
4 {$SiteServerType = “CAS”}
}

$TempObj = New-Object -TypeName PSObject
Add-Member -InputObject $TempObj -MemberType ‘NoteProperty’ -Name ‘Site Code’ -Value $CMSiteCode
Add-Member -InputObject $TempObj -MemberType ‘NoteProperty’ -Name ‘Server Name’ -Value $SiteServerName
Add-Member -InputObject $TempObj -MemberType ‘NoteProperty’ -Name ‘Role Count’ -Value $SiteServerRoleCount
Add-Member -InputObject $TempObj -MemberType ‘NoteProperty’ -Name ‘Site Type’ -Value $SiteServerType

$SiteServersTable  += $TempObj

}
}

$SiteServersTable

Output of the script will be like this

SCCM-GetSiteServers.png

Next Get Site Roles

Again run the following script to get the desired results

#Clear Screen
cls

#GetSCCM sites
$CMSites = Get-CMSite

$SiteRoleWordTable = @{}

ForEach ($CMSite in $CMSites)
{
$SiteRoles = Get-CMSiteRole -SiteCode $CMSite.SiteCode | Select-Object -Property NALPath, rolename

ForEach($SiteRole in $SiteRoles)
{
If(-not (($SiteRole.rolename -eq ‘SMS Component Server’) -or ($SiteRole.rolename -eq ‘SMS Site System’)))
{
$ServerName = ($SiteRole.NALPath).ToString().Split(‘\\’)[2]
$RoleName = $SiteRole.RoleName
$SiteRoleWordTable.add(“$RoleName”,”$ServerName”)
}
}
}

$SiteRoleWordTable

Output of this script as follows

SCCM-GetSiteRoles-Output.png

This is it, Now we have replicated what’s on the SCCM Console for “Servers and Site Roles”.

Next will “Site Maintenance Tasks for Site” and other various Components configurations.

 

No Comments

Add your comment