Solved

How to run a VBS script before deploying Package

Posted on 2008-10-29
8
421 Views
Last Modified: 2013-11-21
I have a simple VBS script (copies a file on the network to a local client - easy stuff) and want this script to run right before or after the package installs.  This script can only be run for a specific package, and I don't care if it runs before or after the package installs.  

Under 'program properties' for the program, on the 'Advanced' tab is an option to 'Run Another Program First.'  I can select a package, but how can I make a package out of a VBS script?  Do I just create a new package with 'xxx.vbs' in the CMD line, and no switches?  Run as hidden?
0
Comment
Question by:NBquery
  • 4
  • 2
  • 2
8 Comments
 
LVL 18

Expert Comment

by:Americom
Comment Utility
What you need to do is create another package in SMS for your VBS script, yes run Hidden. On your other package you have created just like you said in the Program properties for that program, on the Advanced tab, check the "Run another program first". Then right under that, click on the drop down botton on the right side of Package and select the package you created for the VBS script. That's all you need. When you deploy your program package, it will run the VBS first then the program installation of your package.
0
 

Author Comment

by:NBquery
Comment Utility
Well, I got the package created in SMS, but it doesn't seem to be working.  I have it set as 'Hidden' and in the CMD line of the program:
'script.vbs'

There are no switches or arguments on the CMD line, just the vbs name.  Is there something else I ned to include on the CMD line?  The status manager is reporting a successful install, but its not doing anything.
0
 
LVL 5

Accepted Solution

by:
DecKen earned 250 total points
Comment Utility
try changing the command line of your VB script package to
cscript script.vbs
0
 
LVL 18

Expert Comment

by:Americom
Comment Utility
Won't hurt to try cscript...
btw, did you just type the script.vbs in the command line when configuring the package? If so, make sure you use browse to find the script.vbs instead of manually typing it in. Where ever the path of this script.vbs, try run it from the path manually from your SMS server to verify it is working through the path and security, assuming the account you use also have the same permission as the SMS Admin account you use that have access to all servers resources. Also, you can change the Hidden to Maximized to see if it's doing anything.
0
Wish Marketing would stop bothering you?

Is your marketing department constantly asking for new email signature updates? Are they requesting a different design for every department? Do they need yet another banner added? Don’t let it get you down! There is an easy way to manage all of these requests...

 

Author Comment

by:NBquery
Comment Utility
Weill, that's not working really.  I ran the script on the sms server and it copied the file I specified in the script from the remote server, to the local Windows directory.

Not sure whats going wrong.  He is the vb script I'm using:

DIM objFSO, sFile, strComputer
'On Error Resume Next
'sFile="c:\windows\saplogon.ini"
set objFSO=createobject("scripting.FilesystemObject")
'if objFSO.fileexists(sFile)=true then
'else
  objFSO.CopyFile "\\dcdfs11\AllAccess\logon.ini", "c:\windows\"
'End if
Wscript.quit

Can anyone see a issue with the above script, whats causing it to flake out on me?  I have tried setting the package CMD line to 'cscript script.vbs' and also 'script.vbs' on its own.
0
 
LVL 5

Expert Comment

by:DecKen
Comment Utility
When you run the script via SMS by default its going to use the system account unless you set it to run as a different account.
Check the access to \\dcdfs11\AllAccess\logon.ini does everyone have access to the file?
0
 

Author Comment

by:NBquery
Comment Utility
Yes, everyone at the company has read access to that directory.  SMS is running the program with Administrator rights.
0
 

Author Closing Comment

by:NBquery
Comment Utility
Unfortunately, this script did not run but we cannot tell if its due to SMS or our networking environment.  Still pretty good suggestion.
0

Featured Post

Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

Join & Write a Comment

The environment that this is running in is SCCM 2007 R2 running on a Windows 2008 R2 server. The PXE Distribution point is running on its own Windows 2008 R2 box. This is what Event viewer showed after trying to start the WDS service:  An erro…
Remote Desktop Protocol or RDP has become an essential tool in many offices. This article will show you how to set up an external IP to point directly to an RDP session. There are many reasons why this is beneficial but perhaps the top reason is con…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now