Beginning with SCCM 1706, you can now run and deploy Powershell script from the SCCM console. In addition, all directly from the SCCM console you can: edit your scripts, import existing scripts, approved or deny scripts, run script on specific collections and examine the scripts results. This can be useful to run a script quickly without the burden of creating a package or an application.

Unlike standard deployments, when you deploy scripts, they are run almost immediately using Client Operations.

This feature is still in pre-release version and needs to be enabled manually before using it.

Prerequisites for SCCM Deploy PowerShell Script

Before using scripts on your clients you need :

  • SCCM 1706
  • Create and Run scripts pre-release features enabled
  • Targeted clients must have client version 1706+
  • Clients must be running PowerShell v3.0+
  • Have the necessary SCCM permissions

Enable Create and Run Scripts Feature

  • Open the SCCM Console
  • Go to your Administration / Site / Hierarchy Setting
  • Ensure that you have the Consent to use Pre-Release features enabled. You’ll also notice a new option for script approval there
  • Click Ok

  • Go to Administration / Updates and Servicing / Features
  • Right-click Create and run scripts select Turn On

  • On the warning, click Yes

  • Close the Console and reopen it
  • You’ll have a new Script Node under Software Library

SCCM Deploy PowerShell Script

SCCM Security Role Permission

To approve, create and deploy scripts, your user must have the required SMS Script permission. You have those rights only in the Full Administrator role or when creating a custom security role.

SCCM Deploy PowerShell Script

[x_alert heading=”Note” type=”info”]The run script rights are under Collections / ResID:RunScript[/x_alert]

Create a Script

Let’s create our first script.

  • In the Software Library / Scripts node
  • Right-Click Scripts and select Create Script

SCCM Deploy PowerShell Script

  • Give your script a name, select your language (PowerShell only…for now)
  • Click Import if you already have a saved script or use the available text box to write your script

SCCM Deploy PowerShell Script

  • In the Summary screen, click Next

SCCM Deploy PowerShell Script

  • In the Completion screen, click Close

SCCM Deploy PowerShell Script

  • Your script is created and needs to be approved before it can be deployed

SCCM Deploy PowerShell Script

Approve Script

We now need to approve the script. If you can’t approve your own script, see the previous section to disable the option in your Hierarchy Settings. That’s an interesting feature that assures that you are controlling the script that can be deployed.

  • Right-Click your script and select Approve/Deny

SCCM Deploy PowerShell Script

  • Review the script and make sure that it’s ok

SCCM Deploy PowerShell Script

  • Select Approve and put a comment if needed

SCCM Deploy PowerShell Script

  • In the Summary screen, click Next

SCCM Deploy PowerShell Script

  • In the Completion screen, click Close

SCCM Deploy PowerShell Script

Run Script

A script can be run on a collection or on a single device. Once the script is deployed it’s given 1-hour windows to run on the computer. If it’s offline during that period, the script will need to be run again. Make sure that the clients have the necessary requirements. (See Prerequisites section at the top of this post)

  • Select your collection or device and select Run Script

SCCM Deploy PowerShell Script

  • Select your script. Only approved scripts are listed

SCCM Deploy PowerShell Script

  • Review your settings and click Next

SCCM Deploy PowerShell Script

  • Click Close

SCCM Deploy PowerShell Script

Monitoring

We’ll now check if the script has run successfully on our device :

  • Monitor the script deployment statistics under Monitoring / Client Operation
  • You can see that 1 client has run it and has 1 success

SCCM Deploy PowerShell Script

  • Monitor the script execution statistics un Monitoring / Script Status
  • You can see the Script Execution State, the Exit Code and the Output

SCCM Deploy PowerShell Script

Verification

  • The client downloads the script locally in C:\Windows\CCM\ScriptStore

The name of the script contains the script GUID. It can be found in the SCCM Console by adding the Script GUID column

SCCM Deploy PowerShell Script

  • Log file for the script will be located in C:\Windows\CCM\logs\Scipts.log
Comments (27)

Blaine Kehl

01.09.2020 AT 11:49 AM
Does anyone know a way to schedule a Powershell script to run in SCCM? I need to run a script on a collection of computers at 10PM on a certain day and don't want to do it manually.

DeviantDan

01.15.2020 AT 08:55 AM
I would just build it as an Application so you can schedule to run whenever you want. For Deployment type choose Script and the the Installation program something like this: Powershell.exe -ExecutionPolicy ByPass -File YourScript.ps1 Make sure to setup the deployment far in advance.

BestFelipe

07.21.2019 AT 09:12 PM
I have noticed you don't monetize systemcenterdudes.com, don't waste your traffic, you can earn extra cash every month with new monetization method. This is the best adsense alternative for any type of website (they approve all websites), for more info simply search in gooogle: murgrabia's tools

InterSnap

06.07.2019 AT 09:20 PM
If yoou buy 100s off ads but have pߋor ѕales copy you're going to get nno rеsuⅼts. Squіdoo еnables anyone to dеvеlop a pagе on tһe subject they'vе passion about ,write as numerous pages since they like, then Sqսіdoo uses adertising on these pageѕ. Just join with these to get going and choose thoѕe who yoᥙ want to adѵertise.

Brandon

03.12.2019 AT 10:58 AM
How to tell who (which admin) ran the script? I don't see that in the SCCM console. Is there a log file on the server, perhaps? Thank you

best cc

01.15.2019 AT 12:09 PM
additionally it is remarked that beginnrr investors are puzzled, worried and puzzled from the problems involved insie the stock trading game performing. There are several benefits that working capital financing offers to entrepreneurs. Nott havong enough bank balance too your credit to secure a good living place even on rent on your own and your family members.

irancorporate.ir/

11.15.2018 AT 01:45 AM
What's up to all, the contents present at this web site are in fact awesome for people experience, well, keep up the nice work fellows.

hostin wordpress sites

10.20.2018 AT 06:52 AM
Newsbloggers, for starters, are filling oout where traditional news print media are neglecting. Turn comments on and let people comment to cquire feedback from your public. I know this as outstanding results, however you should recognize that your videos can prolduce exactly the same latest results for you also.

kanwar manoria digital incorporated

10.17.2018 AT 12:04 PM
Just want to say your article is as astonishing. The clarity in your post is simply great and i can assume you're an expert on this subject. Well with your permission allow me to grab your feed to keep up to date with forthcoming post. Thanks a million and please keep up the enjoyable work.

highest cash back

09.15.2018 AT 02:52 AM
These сampaigns in many cqses are extremely expensive, since they reuire being continued over thе aany ρeriod of time of time. But I hardly undeгstand so why do countlеss business people still rely on spreadsheets to formulaate andd ɡaze after theiг budget and analyze their profitability. Adxitiօnally үou cann use strict deposіt for frfee which wikll help individuals not pay eхρensive check-cashing fees.

David Martinez

08.28.2018 AT 07:34 PM
I want to deploy Scripts on a schedule and not manual .. any ideas

Niesse

10.02.2018 AT 11:14 AM
Use the script to create a task in task scheduler? else, theres gpo and ceate an application the re-runs... all roads lead the way to Rome...

ibcbet asian handicap live odds

08.06.2018 AT 07:14 AM
Wonderful blog! Do you have any tips and hints for aspiring writers? I'm hoping to start my own blog soon but I'm a little lost on everything. Would you recommend starting with a free platform like Wordpress or go for a paid option? There are so many choices out there that I'm completely overwhelmed .. Any ideas? Appreciate it!

Halil

06.29.2018 AT 04:31 AM
hi people, which book do you prefer for the newbies that has no idea? many thanks

cdnsteel

06.27.2018 AT 03:41 PM
Hannes - if you want the script to run on a schedule, it may be better to set up a configuration baseline that is set to run on a particular remediation schedule. Skylar - from what I'm seeing, the scripts run under SYSTEM. You can see Powershell pop up and disappear in Task Manager. Is anyone having troubles running scripts against Windows 7 computers? Everything I've tried on Windows 7 is failing or not taking action when running.

Jefferson

12.18.2018 AT 11:35 AM
I hit an issue using Run Script on Windows 7 machines. The Script status would indicate the overall script execution succeeded, but my script (which uninstalls software) appeared to have no effect. I discovered that most of our Windows 7 machines have an outdated version of the Windows Management Framework installed. Updating to Windows Management Framework 5.1 in our case (which required first installing 4.0 and a reboot) did the trick and the script actually runs now on our Windows 7 devices.

eyewear

06.06.2018 AT 12:24 AM
Got nothing to tell about me I think. Lovely to be a part of this site. I really wish I'm useful at all https://sunglasses.guru

Michael Raae

02.02.2018 AT 06:00 AM
Hi Skylar Did you get an answer? I´m also wondering about the execution account

Mithun

01.17.2018 AT 06:06 AM
I am trying to create run script in SCCM 2016(ver 1706) and deploy it to a collection/Machine. Is there any module available to achieve the same using powershell.

Luis

12.04.2017 AT 10:28 AM
Anyone else experiencing issues with the script status window being empty? Tried a few times to rerun the script to my collection which is successful but the script status still says "no items found"

Prathap

11.27.2017 AT 12:08 PM
I am not able to get any option to edit the approved script. Am i missing something? regards Prathap