Something I find very hard to do in practice is keeping documentation up to date, if you don't automate this it simply will not get done. In this post I am sharing a PowerShell function that can be used to get all your Configuration Manager servers and what roles they have, great for building automated documentation.
Function Get-PopsCMServers{ <# .SYNOPSIS Get a list of your CM servers .DESCRIPTION Get a list of your CM servers .PARAMETER SiteServer Your siteserver .EXAMPLE Get-PopsCMServers -SiteServer mycmsite.scriptingnerd.com .NOTES .LINK scriptingnerd.com/2024/01/29/powershell-script-for-getting-your-configuration-manager-servers/ #> param( [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String]$SiteServer ) $SMSProvider = Get-WmiObject SMS_ProviderLocation -Namespace root\sms -Filter "ProviderForLocalSite = True" -ComputerName $SiteServer $SiteCode = $SMSProvider | Select-Object -ExpandProperty SiteCode $ProviderMachine = $SMSProvider | Select-Object -ExpandProperty Machine Get-WmiObject -Class SMS_SystemResourceList -Namespace root\sms\site_$SiteCode -ComputerName $ProviderMachine | Select-Object RoleName, ServerName, SiteCode | Sort-Object -Property ServerName }
Hope this was helpful to you
Happy scripting!