Deploy PowerShell Script using SCCM

Pre-release feature In the SCCM 1706. Beginning with version 1802, this feature is no longer a pre-release feature, we get a new ability to deploy script using SCCM, we can create, edit, and import existing scrips.
Well, We could deploy some scripts via Package, Application deployment as well, but right now we have intended feature for this demand.

For my demonstration, I am going to deploy “Maintenace Windows“, I have prepared this PowerShell WIndow and revise it according to my article:
https://www.pelegit.co.il/informing-users-powershell-script/

SCCM PowerShell supports on:
Parameter types: integer, string, and list.

 

Note:
Clients must be running PowerShell v3.0+

Open the SCCM Console management go to your Administration > Site > Hierarchy Setting:

Go to “Administration” > “Updates and Servicing” > “Features”
Make sure “Create and run script is turning on”:

 

Go to “Software Library“:

 

Import your script and set a name:

 

The script is ready, but it’s waiting for approval, by the way, in a case, the “Approval” is as grayed out it means that you haven’t unchecked the “Script authors require additional script approval” option in the previous settings on “Hierarchy Setting”:

 

Once you approve it you get the following window:
Proceed with next:

 

Approve:

The approve or deny script completed successfully:

Let’s run the script:
Go to “Assets and Compliance” and then right click on the preferred collection and “Run Script“:

Select your script:

Deploying is in-progress…

Summary:

We want to monitor the deployment right?, so we should navigate to “Monitoring” > “Client Operation“, and here we can see the script deployment status:

You can go over the “ScriptStore” log file on “C:\Windows\CCM\ScriptStore”


You can see the downloaded script on:
C:\Windows\CCM\logs\Scipts.log
Maintenance message deployed successfully, the client gets the following message: