SCCM多国笔记本镜像部署后手动配置自动化方案咨询
Hey there! Let's break down how to automate those post-deployment steps right in your SCCM task sequence so you can skip the manual work entirely. We'll cover both power settings and Software Center package execution.
1. Automate Power Settings (Lid Action + Fast Startup)
The easiest way to handle this is with a PowerShell script that you can run directly in your task sequence. Here's what the script should include:
Set "Do Nothing" When Closing the Lid
We'll use the powercfg command to modify both AC and DC power schemes:
# Set lid action to "Do Nothing" for AC power powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_BUTTONS LIDACTION 0 # Set lid action to "Do Nothing" for DC (battery) power powercfg /SETDCVALUEINDEX SCHEME_CURRENT SUB_BUTTONS LIDACTION 0 # Apply the changes immediately powercfg /SETACTIVE SCHEME_CURRENT
Enable Fast Startup
Fast Startup relies on hibernation being enabled, so we'll handle both requirements:
# Enable hibernation (required for Fast Startup to work) powercfg /hibernate on # Toggle Fast Startup via registry Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name "HiberbootEnabled" -Value 1 -Type DWord
Add This to Your Task Sequence:
- Create a new Run PowerShell Script step in the State Restore phase (or a custom Post-Deployment group you add) of your task sequence.
- Paste the combined script into the "Script" field, or reference a script package stored in your SCCM library.
- No extra permissions needed here—task sequence steps run in system context by default, which has full access to modify power settings and registry keys.
2. Automate Running Software Center Packages
There are two solid approaches here—pick the one that fits your deployment workflow:
Option 1: Install Directly in the Task Sequence (Simplest)
If you don't need the packages to appear in Software Center first, just add an Install Software step for each package right in your task sequence. This installs them during the deployment process, eliminating the need for post-deployment manual action entirely.
Option 2: Trigger Existing Software Center Deployments
If you need to trigger available deployments (the ones users would normally run manually in Software Center), use a PowerShell script that calls the SCCM Client WMI provider.
First, grab the Deployment ID for each package:
- In the SCCM Console, go to Software Library > Application Management > Applications
- Find your app, navigate to the Deployments tab, right-click the deployment > Properties
- Copy the Deployment ID from the General tab
Then use this script (replace the placeholder IDs with your actual ones):
# Refresh SCCM client policies to ensure deployments are visible Invoke-WmiMethod -Namespace root\ccm -Class SMS_Client -Name TriggerSchedule -ArgumentList "{00000000-0000-0000-0000-000000000121}" Start-Sleep -Seconds 10 # Give the client time to pull updated policies # Trigger installation of the first package $DeploymentID1 = "YOUR_FIRST_DEPLOYMENT_ID" Invoke-WmiMethod -Namespace root\ccm\ClientSDK -Class CCM_SoftwareDistribution -Name InstallContent -ArgumentList $DeploymentID1, $null # Add a delay if needed, then trigger the second package Start-Sleep -Seconds 30 $DeploymentID2 = "YOUR_SECOND_DEPLOYMENT_ID" Invoke-WmiMethod -Namespace root\ccm\ClientSDK -Class CCM_SoftwareDistribution -Name InstallContent -ArgumentList $DeploymentID2, $null
Add This to Your Task Sequence:
- Add another Run PowerShell Script step right after the power settings script.
- Paste the script with your actual Deployment IDs.
- Optional: Add a Wait for SCCM Client Registration step before this to ensure the client is fully connected to your SCCM site and ready to receive commands.
Pro Tips
- Test the power settings script first on a test machine—some OEMs have custom power schemes that might override your settings. If this happens, add a line to set your desired scheme as active first (use
powercfg /LISTto get scheme GUIDs). - For the Software Center trigger, if you run into permission errors, double-check that the task sequence step is running in system context (it should be by default).
- Add logging to your scripts to troubleshoot issues later—for example, append output to a log file with
>> C:\PostDeploy_Logs.txtat the end of your PowerShell commands.
Give these steps a try, and let me know if you hit any snags—like trouble grabbing Deployment IDs or power settings not sticking. Happy automating!
内容的提问来源于stack exchange,提问作者Wim




