SCCM 2012 Run a vbscript

I've tried to piece together other posts on this topic but have yet to successfully do this.  Could someone please provide a step by step on how to run a vbscript with SCCM 2012 SP1?  Please be as detailed as possible, because I would like to understand the nuances of why a certain setting is being set and why certain selections are being selected.

I've tried many different settings but haven't found the correct combination or something.  If it matters, the vbscript copies a file from a network share available to everyone and also creates a shortcut to the company intranet site.  Everything tests out locally, but just cannot get this to work via SCCM 2012 SP1.  This is what I have to work. 

Please just post a how to with as much detail as possible.  THANKS!!!


  • Edited by HMote Wednesday, May 01, 2013 10:15 PM
May 1st, 2013 10:14pm

so your problem is you are trying to copy a file from a network share. when you say everyone has rights to the share are your sure? What are the EXACT permissions on the share and files? Why not include the shortcut within the package itself?
Free Windows Admin Tool Kit Click here and download it now
May 2nd, 2013 12:28am

Hi Garth...I figured this might happen. Thanks for the reply, but could you provide detailed steps on how to run a vbscript with SCCM 2012 SP1. I want to verify that I get that part correct first. The vbscript works but not through SCCM. It's not permissions because its our directory that we use for app, client, etc installs. Thanks!
May 2nd, 2013 2:03pm

There are no special steps to running a vbs, in CM12 or CM07. However if you are trying to copy file from a network share, you are asking for trouble. The #1 reason for issues is that the permission are NOT setup correct. The permission are not setup correctly because everyone forgets that CM12 runs as local system account and therefore does NOT have access to network shares (by default).

So going back to my original questions:

  • What are the EXACT permissions on the share and files?
  • Why not include the shortcut within the package itself? BTW this is the simplest solution to the problem.

Free Windows Admin Tool Kit Click here and download it now
May 2nd, 2013 2:28pm

Regardless of what my vbscript is doing, how do you run a vbscript in SCCM 2012? What are the settings? I wasn't really asking how to fix my problems, although I did give those details. The permissions part is easy...no? I just need to make sure my deployment is setup correctly. I need to know how to walk before I can run. Thanks! :)
May 2nd, 2013 2:53pm

Hi,

Here's a very important link for testing your scripts prior to deployment:

http://myitforum.com/cs2/blogs/jmarcum/archive/2010/08/25/150872.aspx

As for how to push a VBScript, it's quite simple and I've pushed plenty of them. Here's some details (you can change any of these as necessary, I'm just supplying you with the values that I have in place that work for this particular script):

Create Package/Program.

Program details:

Command line: blah.vbs

Run: Hidden

After running: No action required

Program can run: Whether or not...

Run mode: Run with administrative rights

Drive mode: UNC

Suppress program notifications: Checked

  • Marked as answer by HMote Monday, May 13, 2013 6:29 PM
Free Windows Admin Tool Kit Click here and download it now
May 2nd, 2013 3:09pm

Thanks for the reply Mike.  Do you not have to include cscript blah.vbs?

May 13th, 2013 4:47pm

In case anyone else has this question and if Mike's settings above don't seem to work for your script.  Here's my settings on how I got mine to work.  Please do note that this is running on SCCM 2012 SP1 incase the other versions are different:

- Create new package

- Browse to the location of your script file in the 'Source folder' box; choose network path (UNC).  I placed my resources in the same path as other apps that have been pushed out, this way I knew that there wouldn't be permissions issues with retrieving the source material.

- Standard program

- Command line: cscript script.vbs

- Startup folder:  left this empty

- Run: Minimized

- Program can run:  Only when a user is logged on.  I used this setting because the script places the shortcut only on the current users desktop.

- Run mode:  Run with user's rights

- Drive mode:  Runs with UNC name

- I set the requirement to only check for 1 MB of space, I'm not sure that this is even needed.

- When deploying, I set the purpose to 'Required', because I wanted every device in the collection to receive the shortcut

- Assignment schedule: ASAP

- User Experience, I kept the defaults and selected 'Software Installation'

- Deployment options (set both the same):  Download content from distribution point and run locally

These settings should allow you to push, at least, a script that installs a shortcut to the current users desktop when they login.  Hopefully this helps someone in the future.  Thanks!

  • Marked as answer by HMote Monday, May 13, 2013 6:28 PM
Free Windows Admin Tool Kit Click here and download it now
May 13th, 2013 6:28pm

Personally, I could not get my script to run until I set the following

- Command line: cscript .\scriptname.vbs

March 20th, 2014 7:01pm

Personally, I could not get my script to run until I set the following

- Command line: cscript .\scriptname.vbs


That's a good point, cscript vs wscript may provide different results.
Free Windows Admin Tool Kit Click here and download it now
March 20th, 2014 7:45pm

I've tried Mike's initial suggestion, his .\ suggestion, and HMote's suggestion and none work for me. Nothing appears in the antivirus logs as a block either. I have SCCM 2012 R2 SP1. The command lines "cscript file.vbs" and "cscrpt .\file.vbs" both drop into the ccmcache but don't clear the cache. Also note, if I run this script myself from a admin command prompt it works fine.

The code I'm trying to run to clear out the ccmcache folder is from:

http://www.myitforum.com/forums/CCM92Cache-clear-up-m196226.aspx

Any more suggestions?&#

August 6th, 2015 9:22am

I've tried Mike's initial suggestion, his .\ suggestion, and HMote's suggestion and none work for me. Nothing appears in the antivirus logs as a block either. I have SCCM 2012 R2 SP1. The command lines "cscript file.vbs" and "cscrpt .\file.vbs" both drop into the ccmcache but don't clear the cache. Also note, if I run this script myself from a admin command prompt it works fine.

You can't clear the cache while it is in use. You need to setup this program to run from the DP, then it will clear the cache.
Free Windows Admin Tool Kit Click here and download it now
August 6th, 2015 9:39am

Garth, you're awesome!

I changed my settings back to Mike's original suggestion (no .\, etc) and it worked. We've never had to run from the dp b

August 6th, 2015 9:56am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics