Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, October 3, 2014 4:47 PM
Hello All
This is my first attempt at deploying a script via SCCM 2012 R2 and I seem to be stuck. Essentially what this script does is map a printer. The script on its own works fine. Meaning it works when I double click it and also running it from the command line. Its when I try to use in sccm things go down hill. I have tried the following from the command line in the package properties.
\my-sccm-server\Sources\Applications\VBSripts\cscript.exe Impact.vbs
\my-sccm-server\Sources\Applications\VBSripts\Impact.vbs
Phil Balderos
All replies (18)
Friday, October 3, 2014 4:53 PM ✅Answered
Hi,
Running a vbscript works just fine if you specify the package source catalog then you only have to write cscript.exe script.vbs on the command line.
What is a difference though is that when you execute it using SCCM it either is executed as System or User context based on what you have configured it to use.
You can test the script uisng psexec so it runs in system or a Schedule Task and run the script as system there.
Regards,
Jörgen
-- My System Center blog ccmexec.com -- Twitter @ccmexec
Friday, October 3, 2014 5:29 PM ✅Answered
On your data source page, that looks good. What will happen is the client will get ALL of the files and folders you specified in the source directory and download them to the client cache, which by default lives in \windows\cchcache\someFolder
Then the client will run the command line you entered from the cache folder. So the client is trying to run \sources\application....vbs, which fails because the client has no idea what that path means.
As Jorgen said previously, change your command line to cscript impact.vbs and that should work fine, as long as the script is correct.
Friday, October 3, 2014 10:04 PM ✅Answered
As long as the .vbs is in the source directory, then the client should have downloaded it to the local cache, and then run it under Local System context.
Wally Mead
Saturday, October 4, 2014 10:56 AM ✅Answered
looks good :)
You can check execmgr.log on the client to monitor the install as it is running.
Monday, October 6, 2014 1:18 PM ✅Answered
looks good :)
You can check execmgr.log on the client to monitor the install as it is running.
Thank Richk,
Still no luck. Here is the output from execmgr.log. Its saying that is completed but nothing ever happens. I am about ready to throw in the towel on this one but I just feel like that is should work because its such a simple script.
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\srv-gtt-papercut\followme"
WshNetwork.SetDefaultPrinter "\srv-gtt-papercut\followme"
Phil Balderos
Is the script running as an Admin ,if so then you likely set the printer up for the local system user account and not anyone else.
Garth Jones | My blogs: Enhansoft and Old Blog site | Twitter: @GarthMJ
Monday, October 6, 2014 1:52 PM ✅Answered
No I am logged into the computer with a non admin account and when I double click it runs just fine the printer installs in seconds. When I package it in SCCM nothing happens.
That does not answer Garth's question.
How is the program configured (environment tab)?
Torsten Meringer | http://www.mssccmfaq.de
Monday, October 6, 2014 1:57 PM ✅Answered
Have you verified that your script runs well as system? [EDIT: See Torsten's response below for the reasoning behind this question.]
http://myitforum.com/cs2/blogs/jmarcum/archive/2010/08/25/150872.aspx
Any reason you're not using GPP for printers? That's always easier than trying to use script methods (in my experience, at least).
Don't retire TechNet! - (Don't give up yet - 13,085+ strong and growing)
Monday, October 6, 2014 3:06 PM ✅Answered
"Run with admin rights" will execute the script in System context so the settings will apply to it. Printer settings are user-based though.
Torsten Meringer | http://www.mssccmfaq.de
Monday, October 6, 2014 3:15 PM ✅Answered
In the environment tab its configured to run with admin rights. Does this mean I need to choose the other option "Run with user rights"? In all of the packages I created I have actually never changed this setting.
So this mean that you have setup a printer for the Local System account, which BTW (by default), can't access a remote network device.
Garth Jones | My blogs: Enhansoft and Old Blog site | Twitter: @GarthMJ
Monday, October 6, 2014 4:16 PM ✅Answered
Thanks guys!! It worked. I changed the Run mode to "Run with users rights" and it worked. I tested on about 5 computers and the printer installed in less then 5 seconds :)
More importantly I learned something new.
Thanks
Phil
Phil Balderos
Friday, October 3, 2014 5:04 PM
Hi,
Running a vbscript works just fine if you specify the package source catalog then you only have to write cscript.exe script.vbs on the command line.What is a difference though is that when you execute it using SCCM it either is executed as System or User context based on what you have configured it to use.
You can test the script uisng psexec so it runs in system or a Schedule Task and run the script as system there.
Regards,
Jörgen-- My System Center blog ccmexec.com -- Twitter @ccmexec
Hello Jorgen,
I have no idea how to use psexec and will have to try to figure that out later. I was hoping for a quicker solution. :(
Phil Balderos
Friday, October 3, 2014 5:12 PM
Hi,
Looks like your running the script from a share. The client local system account will need to be able to access that UNC.
You might need to grant everyone share and read permissions or you could copy the vbcript into a folder on the SCCM server and create your package this way:
Select "This package contains source files" and browse to the folder with the VBscript in it.
You don't need to use cscript or wscript in your command line, you can just point straight to the vbscript and it will work fine. I didn't realise this until recently when Jason pointed it out.
Friday, October 3, 2014 5:24 PM
Hi,
Looks like your running the script from a share. The client local system account will need to be able to access that UNC.
You might need to grant everyone share and read permissions or you could copy the vbcript into a folder on the SCCM server and create your package this way:
Select "This package contains source files" and browse to the folder with the VBscript in it.
You don't need to use cscript or wscript in your command line, you can just point straight to the vbscript and it will work fine. I didn't realise this until recently when Jason pointed it out.
Thanks Mark
This is what I have already in place
Phil Balderos
Friday, October 3, 2014 5:38 PM
On your data source page, that looks good. What will happen is the client will get ALL of the files and folders you specified in the source directory and download them to the client cache, which by default lives in \windows\cchcache\someFolder
Then the client will run the command line you entered from the cache folder. So the client is trying to run \sources\application....vbs, which fails because the client has no idea what that path means.
As Jorgen said previously, change your command line to cscript impact.vbs and that should work fine, as long as the script is correct.
Thanks guys!
Is this what it should look like?
Phil Balderos
Monday, October 6, 2014 1:09 PM
looks good :)
You can check execmgr.log on the client to monitor the install as it is running.
Thank Richk,
Still no luck. Here is the output from execmgr.log. Its saying that is completed but nothing ever happens. I am about ready to throw in the towel on this one but I just feel like that is should work because its such a simple script.
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\srv-gtt-papercut\followme"
WshNetwork.SetDefaultPrinter "\srv-gtt-papercut\followme"
Phil Balderos
Monday, October 6, 2014 1:44 PM
Hi Garth,
No I am logged into the computer with a non admin account and when I double click it runs just fine the printer installs in seconds. When I package it in SCCM nothing happens. I know software distribution works I just deployed two apps this weekend to our company.
THanks,
Phil
Phil Balderos
Monday, October 6, 2014 2:58 PM
No I am logged into the computer with a non admin account and when I double click it runs just fine the printer installs in seconds. When I package it in SCCM nothing happens.
That does not answer Garth's question.
How is the program configured (environment tab)?Torsten Meringer | http://www.mssccmfaq.de
Hello Torsten,
In the environment tab its configured to run with admin rights. Does this mean I need to choose the other option "Run with user rights"? In all of the packages I created I have actually never changed this setting.
Phil Balderos
Monday, October 6, 2014 6:14 PM
glad you got it sorted pal :)