Create, Approve, Run and Monitor PowerShell Scripts in Configuration Manager
Configuration Manager can run approved PowerShell scripts against devices or collections. This is a powerful administrative feature, so enable it only with appropriate role-based access and change control.
1. Confirm prerequisites
- Clients and site infrastructure must support the Run Scripts feature for your installed Configuration Manager version.
- The administrator needs the relevant Scripts and Run Script permissions.
- Decide whether your organisation requires a different administrator to approve a script before it can run.
2. Create the script
- Open the Configuration Manager console.
- Go to Software Library > Scripts.
- Choose Create Script, give it a descriptive name and paste/import the PowerShell code.
- Use parameters rather than hard-coded environment values where possible.
- Review the summary and create the script.
3. Approve it
If approval is required, an authorised approver should open the script, review the actual code and approve it with a meaningful comment. Approval should never be treated as a rubber stamp.
4. Run with a small scope first
- Start with one test device or a small test collection.
- Choose Run Script, select the approved script and confirm the target.
- Review live execution results before expanding the scope.
5. Monitor and troubleshoot
Use the console’s script status/monitoring views and client logs to confirm execution and output. A successful command should be designed to return a clear exit/result value; do not assume “no error popup” means the script made the intended change.
Reference: Microsoft Learn – Create and run PowerShell scripts from the Configuration Manager console.