myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


  


Advertising batch file via SMS 2003

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Management Products] >> Microsoft Systems Management Server >> SMS 2003 >> Advertising batch file via SMS 2003 Page: [1]
Login
Message << Older Topic   Newer Topic >>
Advertising batch file via SMS 2003 - 11/7/2008 3:40:47 PM   
jpatridge

 

Posts: 16
Score: 0
Joined: 9/18/2007
Status: offline
Hi -

We're using SMS 2003 SP3. One of our groups would like to advertise the batch file below to a group of machines using SMS. I'm still learning scripting, and am not sure how to convert to vbs.

Can anyone please give me suggestions when advertising a batch file to machines? The file references a UNC path. Are there any gotchas I need to be aware of? Text of the batch file below:

xcopy \\man-filer1\PCI_password_server\Import\importpfx.exe C:\windows /y
md c:\pciwin\exe
xcopy \\man-filer1\pci_password_server\exe\*.* c:\pciwin\exe /s /y
cd\windows\microsoft.net\framework\v2.0.50727
regasm c:\pciwin\exe\web\pciweb.dll /codebase
c:\pciwin\exe\pcipasswordparse.exe /regserver

Thanks,

Joe
Post #: 1
RE: Advertising batch file via SMS 2003 - 11/7/2008 4:14:13 PM   
rtruss


Posts: 254
Score: 11
Joined: 11/4/2004
Status: offline
How does it work when you run it from a command prompt?

_____________________________

Roger Truss
Assistant Windows Administrator
SMS Admin
Trend Micro Admin
ImageUltra Admin

Please rate my post ;)

(in reply to jpatridge)
Post #: 2
RE: Advertising batch file via SMS 2003 - 11/7/2008 4:30:19 PM   
jpatridge

 

Posts: 16
Score: 0
Joined: 9/18/2007
Status: offline
It works fine, but in the past I've had problems w/ running batch files from SMS - I've usually figured out some other workaround in those cases. And from what I've read online, there are various issues, particularly if you're referencing UNC paths, so I'm trying to see if there is a list of do's and don'ts.

(in reply to jpatridge)
Post #: 3
RE: Advertising batch file via SMS 2003 - 11/11/2008 1:32:49 AM   
jnelson993


Posts: 959
Score: 132
Joined: 2/18/2005
From: Minneapolis, MN
Status: offline
I wrote a little ditty a while ago on some things to think about with .BAT files from SMS
http://myitforum.com/cs2/blogs/jnelson/archive/2008/08/15/121348.aspx



_____________________________

Number2 (John Nelson)
MyITForum - Blog
MyITForum - Forum Posts

(in reply to jpatridge)
Post #: 4
RE: Advertising batch file via SMS 2003 - 11/11/2008 6:18:08 AM   
eriksper

 

Posts: 2
Score: 0
Joined: 11/11/2008
From: Uppsala, Sweden
Status: offline
Hi,
Here's another tip that can be helpful:
If the batch file is distributed with a SMS package, make sure that in the Program properties, tab Environment, the checkbox "Requires a drive letter" is checked.

You can see  in the execmgr.log at the client what the actual command will be with resolved path. This setting has solved the problem for me a couple of times.

_____________________________

/Per Eriksson

(in reply to jpatridge)
Post #: 5
RE: Advertising batch file via SMS 2003 - 11/11/2008 1:32:09 PM   
Tom_Watson

 

Posts: 126
Score: 10
Joined: 9/13/2006
Status: offline
Another reason this might not be working is that it is trying to copy from a UNC path that isn't necessarily an SMS share.  By default an SMS advertisement will not have rights to do this, as it will run under a local account's privileges.  This Technet Magazine article explains this nicely:-

http://technet.microsoft.com/en-us/magazine/cc160972.aspx

I personally make sure that if file copying is done within an SMS package, I make sure these files are part of the package source files, and you are doing the copy using a relative path as opposed to an absolute path.

Regards,
Tom Watson



(in reply to eriksper)
Post #: 6
RE: Advertising batch file via SMS 2003 - 11/14/2008 2:10:21 PM   
jpatridge

 

Posts: 16
Score: 0
Joined: 9/18/2007
Status: offline
Thanks to all for the assistance. Using a combination of suggestions from John's blog (replacing UNC path w/ ~dp0) and checking the 'requires a drive letter' option, I've been able to successfully run batch files. Much appreciated.

(in reply to Tom_Watson)
Post #: 7
RE: Advertising batch file via SMS 2003 - 11/14/2008 2:47:08 PM   
criticalerror

 

Posts: 110
Score: 0
Joined: 6/19/2007
Status: offline
I had this same problem. I was getting a script error when trying to run a batch file before another program in a package. I fixed it very easily by changing the extension from .bat to .cmd. As soon as I did this the program ran fine. Hope this helps. Please rate this post if this solution works.

Thanks

(in reply to jpatridge)
Post #: 8
Page:   [1]
All Forums >> [Management Products] >> Microsoft Systems Management Server >> SMS 2003 >> Advertising batch file via SMS 2003 Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



  
Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.297