Solved

Sccm batch file operations (Software Distribution)

Posted on 2009-05-08
3
6,391 Views
Last Modified: 2013-11-21
--Posted on Technet forums but not enough feedback yet, so here it goes

:Hello, i have to backup old Cisco VPN profiles and copy new profiles to the members of a specific collection.

The local support team has provided a batch script to perform these operations, i'm just tasked with making it run via SCCM, this is how the script looks like:

cd\
c:
cd Prog*\Cisco*\VPN*\Profiles
cd Arch*\Cisco*\VPN*\Profiles          -    This line is because some workstations are in spanish, it's not nice but works
mkdir OldProfiles
move * OldProfiles
xcopy OldProfiles \\servername\backupProfilesVPN\Backup\%COMPUTERNAME%\ /s /y
xcopy \\servername\backupProfilesVPN\Profile\"profile.pcf"
exit


This works fine running manually, the share provided to place the old profiles and to copy the new one has Share and NTFS permissions - Everyone Full Control.

I created a package wich has a single file  batchfile.cmd that also names the single program, ie the only program name matches the batch file.

The program is set to run with administrative rights, so even non logged computers will pick the new profile asap.

Drive mode is set to run in UNC mode.

The advertisement is configured to download and run local (and so it does)


However the behavior is different , i get an exit error 4 and i added a pause to the batch and compared the differences


This run manually (on a spanish os computer):

C:\Archivos de programa\Cisco Systems\VPN Client\Profiles>xcopy OldProfiles \\servername\backupProfilesVPN\Backup\%COMPUTERNAME%\ /s /y
OldProfiles\profileversion_-_Corporate_VPN.pcf
1 archivos copiados   (1 file copied)


This run by ccm (same computer):

C:\Archivos de programa\Cisco Systems\VPN Client\Profiles>xcopy OldProfiles \\servername\backupProfilesVPN\Backup\XPSPAIN\ /s /y
La unidad especificada no es válida             -----> (invalid drive specified)
0 archivos copiados   (0 files copied)


Just for reference the package uses a local source folder on the sccm server containing the batch file, but the folder to backup and copy the profile is on a different server.





Could someone point me in the right way or suggest an alternative way to get this done?




Thanks in advance,

Bmq

0
Comment
Question by:bvq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 22

Accepted Solution

by:
Adam Leinss earned 500 total points
ID: 24339029
The SYSTEM account doesn't have access to network resources, so you need to run the program under the rights of the logged in user.
If the users don't have adminstrator rights and your script is doing things like creating folders/file, then you probably will need to chain 2 programs together in 1 package...one that works under SYSTEM to do the dirty work, then the 2nd program would copy off the log file to the server under user credentials.
This can be found in the program itself under the Environment tab>Run Mode.
0
 
LVL 6

Expert Comment

by:question
ID: 24347117
check if the sccm account thats used has the rights to the \\servername\backupProfilesVPN\Backup\XPSPAIN\  location. I would login manually as a the sccm account on the xp machine and would run the program manually and see if i get the same error before i make a move.
   Batch files do not handle UNC path very well. So add a command to map the network drive.

"net use x: \\Server\SomeShare "
after the copying is complete do:-
net use x: /delete

Replace the server name UNC path with the local drive mapped. ie X:
Let me know how it goes.

-Question
0
 

Author Closing Comment

by:bvq
ID: 31579437
This fixed my issue, i was trying to make it run with admin privileges so it would install even without a user being logged on, this way it'll install and run fine but only if a user is logged, not the best way for me, but the job gets done, thanks for the help
0

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

696 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