Overview
This post provides a PowerShell script that creates an SCCM package to integrate a new service manager for managing and streamlining Windows Update services. This package helps streamline the management of Windows Update services across multiple systems, ensuring consistent application of updates.
Instructions
- Copy the provided PowerShell script to a location on your SCCM server.
- Adjust the script variables such as
$SCCMServer
,$SiteCode
, and$PackageSourcePath
to fit your environment. - Run the script in PowerShell to create the SCCM package for the Windows Update Service Manager.
- Distribute the package to the appropriate distribution points within SCCM.
- Monitor the deployment to ensure that the new service manager is successfully integrated across all targeted systems.
What the Script Does
This PowerShell script automates the creation of an SCCM package that integrates a new service manager for Windows Update services. The script checks for any existing packages with the same name and removes them to avoid conflicts. It then creates a new package that can be distributed to ensure efficient management of Windows Update services across your organization.
PowerShell Script
# Define Variables $SCCMServer = "\\YourSCCMServer" $SiteCode = "YourSiteCode" $ScriptName = "Add-Windows-Update-Service-Manager" $ScriptDescription = "This script integrates a new service manager for managing and streamlining Windows Update services." $PackageSourcePath = "C:\Scripts\$ScriptName" # Load SCCM PowerShell Module Import-Module "$($Env:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1" -Force # Connect to the SCCM Site cd "$SiteCode`:" # Check if a package with the same name exists and delete it $ExistingPackages = Get-CMPackage -Name $ScriptName -ErrorAction SilentlyContinue if ($ExistingPackages) { Write-Host "Existing package(s) found. Deleting..." foreach ($Package in $ExistingPackages) { Remove-CMPackage -Id $Package.PackageID -Force } Write-Host "Existing package(s) deleted." } # Create the Package Source Directory if it does not exist if (!(Test-Path -Path $PackageSourcePath)) { New-Item -ItemType Directory -Path $PackageSourcePath -Force } # Create the PowerShell script $ScriptContent = @' # Integrates a new service manager for managing Windows Update services add-wuservicemanager -serviceID 7971F918-a847-4430-9279-4a52d1ef18d '@ $ScriptPath = "$PackageSourcePath\Add-Windows-Update-Service-Manager.ps1" Set-Content -Path $ScriptPath -Value $ScriptContent # Create the SCCM Package $Package = New-CMPackage ` -Name $ScriptName ` -Description $ScriptDescription ` -Path $PackageSourcePath # Create a Program for the Package $Program = New-CMProgram ` -PackageName $ScriptName ` -StandardProgramName $ScriptName ` -CommandLine "powershell.exe -ExecutionPolicy Bypass -File Add-Windows-Update-Service-Manager.ps1" ` -ProgramRunType "WhetherOrNotUserIsLoggedOn" # Distribute the Package to the Distribution Point but do not deploy Start-CMContentDistribution ` -PackageName $ScriptName ` -DistributionPointName "YourDistributionPointName" Write-Host "Windows Update Service Manager package and program created and distributed successfully in SCCM, without deployment."
Explanation
This script sets up an SCCM package that integrates a new service manager for managing Windows Update services. The script ensures that any existing package with the same name is removed to prevent conflicts. The new package is then created and distributed to the specified distribution point, making it ready for depl