bvq
asked on
Sccm batch file operations (Software Distribution)
--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\backupProfile sVPN\Backu p\%COMPUTE RNAME%\ /s /y
xcopy \\servername\backupProfile sVPN\Profi le\"profil e.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\backupProfile sVPN\Backu p\%COMPUTE RNAME%\ /s /y
OldProfiles\profileversion _-_Corpora te_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\backupProfile sVPN\Backu p\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
: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
mkdir OldProfiles
move * OldProfiles
xcopy OldProfiles \\servername\backupProfile
xcopy \\servername\backupProfile
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\backupProfile
OldProfiles\profileversion
1 archivos copiados (1 file copied)
This run by ccm (same computer):
C:\Archivos de programa\Cisco Systems\VPN Client\Profiles>xcopy OldProfiles \\servername\backupProfile
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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