Skip to content

Using cmd files in a sccm 2012 application

Featured Replies

I'm i bit puzzeld at the moment. I've tryed to create an Application to install an msi program and then copy a linces file to a lokal path on the computer. The MSI part of tings work great but not the script I'm running to copy the lisence file. I'm using a simple cmd script to copy the fil and im ending up With a error 0x1(acces denied). I'f I create an package the script Works. Is it not possible to use cmd scripts within an Application? Cheers, Øyvind Skjellin

Maybe you forgot to switch the app to run as local system. Custom apps are running in the user context per default.

Anyways, create an MST file for your MSI which copies the lic file to the correct location. This way you need only a single app.

Try doing VBScripts for the installation and uninstallation, they should work.

 

I've done couple of these, for example for VLC Mediaplayer.

  • Author

Maybe you forgot to switch the app to run as local system. Custom apps are running in the user context per default.

Anyways, create an MST file for your MSI which copies the lic file to the correct location. This way you need only a single app.

Thanks but an Application doesn't have that option to "run as administrator". Creating a .exe/msi file would fix it but I was hoping to just run a cmd script/xcopy string directly from the Application/deployment.
  • Author

Try doing VBScripts for the installation and uninstallation, they should work.

 

I've done couple of these, for example for VLC Mediaplayer.

I'm not going to install using VBS. The SCCM Application will do the thing for the msi installation. Is the copy of the lic file I need to get working within an Application.

Which OS are you installing with - Win 7, 64-bit? If so, be aware that you cannot copy directly to the c:\ drive. Also be cautious of the syswow64 and system32 folders as well as the Wow6432Node registry key. For instance, a 32-bit command prompt will not be able to copy to the Win 7 system32 folder properly. <editorial>Why MS decided to keep the 'System32' folder for 64-bit, is so confusing....</editorial>

I'm not going to install using VBS. The SCCM Application will do the thing for the msi installation. Is the copy of the lic file I need to get working within an Application.

 

And that's what the vbscript could accomplish for you.. just wrap the msi installation in to the vbscript and add the copying of files to the same script. Use detection method by combining the msi's product code and existence of the .lic file.. pretty simple.

 

My idea is that you WRAP the whole installation in to a single script that does the exact thing you're aiming for.

  • Author

And that's what the vbscript could accomplish for you.. just wrap the msi installation in to the vbscript and add the copying of files to the same script. Use detection method by combining the msi's product code and existence of the .lic file.. pretty simple.

 

My idea is that you WRAP the whole installation in to a single script that does the exact thing you're aiming for.

I see your point and it's one way of doing it. I'm was hoping to just kick of a xcopy command within an application just as I do with packages.
  • Author

Which OS are you installing with - Win 7, 64-bit? If so, be aware that you cannot copy directly to the c:\ drive due. Also be cautious of the syswow64 and system32 folders as well as the Wow6432Node registry key. For instance, a 32-bit command prompt will not be able to copy to the Win 7 system32 folder properly. <editorial>Why MS decided to keep the 'System32' folder for 64-bit, is so confusing....</editorial>

I'm copying to a folder in %programdata%.

%ProgramData% you should be able to copy to. Your ConfigMgr package needs to run with administrative rights (run as SYSTEM) to access the ProgramData folder.

 

If your package consists of License.lic and Install_License.cmd, your script could look like this:

 

SET yourpath=%~dp0

XCOPY "%yourpath%License.lic" "%ProgramData%\Microsoft\Windows\blah\blahblah"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.