Month: January 2016
ConfigMgr 2012 R2 PowerShell to Install SMP Role
In a recent customer engagement, we needed to mass deploy the State Migration Point (SMP) role to nearly 70 servers. After completing about a dozen of these one by one, I thought PowerShell would be a much faster way to accomplish the end goal. The below script can be used as an example for finding existing site systems that do not have the SMP role installed, while allowing it to skip servers with certain names (in this example, it skips servers that begin with TEST in the name).
import-module ($Env:SMS_ADMIN_UI_PATH.Substring(0,$Env:SMS_ADMIN_UI_PATH.Length-5) + '\ConfigurationManager.psd1') # Site Code + : $SiteCode = "GAL:" Set-Location $SiteCode #Properties for Setting the SMP Role $UsmtDrivePath = "F:\USMT" $MaxNumClients = 100 $MinFreeSpace = 3 $TimeDeleteAfterDays = 5 $SiteSystemServers = Get-CMSiteSystemServer write-host $SiteSystemServers.Count ForEach ($Server in $SiteSystemServers) { $ServerName = $Server.NetworkOSPath.Replace("\\", " ") $CheckSMP = Get-CMSiteRole -RoleName "SMS State Migration Point" -SiteSystemServerName $ServerName #write-host $CheckSMP.Count # If SMP Count is zero, SMP not installed If ($CheckSMP.Count -eq 0) { If ($ServerName.ToUpper().StartsWith("TEST")) { # Do Nothing, skip this type of server } Else { Write-host "No SMP Role, installing on" $ServerName $Folder = New-CMStorageFolder -StorageFolderName $UsmtDrivePath -MaximumClientNumber _ $MaxNumClients -MinimumFreeSpace $MinFreeSpace -SpaceUnit Gigabyte Add-CMStateMigrationPoint -SiteSystemServerName $ServerName -StorageFolder $Folder _ -AllowFallbackSourceLocationForContent $False -EnableRestoreOnlyMode $False -SiteCode $SiteCode _ -TimeDeleteAfter $TimeDeleteAfterDays -TimeUnit Days } } Else { Write-host "SMP Role installed, skipping server" $ServerName } }