Atomic12 Posted November 22, 2013 Report post Posted November 22, 2013 Hi guys, so this is my first post on the forum and I am hoping you guru's can help me. I will try to describe my problem as accurately as I can. So I will be taking over SCCM 2007 in my company and I am completely new to this so please forgive for the stuff that might seem ordinary to you. We got deployment enviroment setup for cca 200 Users, couple of departments, we use Windows 7 x64 Enterprise SP1. We also use the HTA script in the process, I hope it goes away in the new SCCM 2012 that we have plans to upgrade to. I am supposed to make a very simple think but it does not work for me: install a small 3MB .exe application to program files, and then make a shortcut on desktop for every user that logs into Windows. The batch script looks like this: @echo offmsiexec /i "D:\packages\Support Tools 4.1.0\SupportTools.msi"/qbping -n 11 127.0.0.1 > nulxcopy /s "C:\Program Files (x86)\SupportTools\SupportTools.exe" "C:\Users\Public\Desktop" The file is located on the D: drive of the server on which SCCM 2007 is installed in the "packages" directory. ping is here to give the app 10 sec time to install althought the .exe is a application that is ready to run as soon as you double click it, no install procedure. With the 3rd line of the script I want that same .exe to copy to public desktop folder so all users have instant access to that application. The app was originally exe, but I have made .msi with advanced installer software, and it did work for couple of times but only installation to the program files (x86) folder, but no shortcut on desktop(since I have added ping, the copying to program files does not work anymore). I have ran the app every time with the admin priviliges, maybe that is the issue. But I must emphasize that the script works when I start it manually, it does everything what I want to do with the app. Thank you for your answers, Quote Share this post Link to post Share on other sites More sharing options...
Rocket Man Posted November 22, 2013 Report post Posted November 22, 2013 Simplest way is to create a package with the executable in it and also a copy of the actual shortcut. Then use a batch file as the command to line to install the software first then copy the shortcut also, so the command line will be the actual name of the batch file that execues the install and copy. So maybe something like this: msiexec /i "SupportTools.msi" /qbping -n 11 127.0.0.1copy "NameofShortcut.lnk" "C:\Users\Public\Desktop" That should do the trick! 1 Quote Share this post Link to post Share on other sites More sharing options...
Atomic12 Posted November 22, 2013 Report post Posted November 22, 2013 Hey Rocket Man, thank you for your fast reply, I have been strugling with this issue for the last 3 days, and it takes so long because I can only test it when I deploy a notebook with some other settings. Do you maybe know a different way that I can test various settings without actually deployint a nottebok and waiting 45 min every time? I will try your trick first thing on monday morning. Thank you, Quote Share this post Link to post Share on other sites More sharing options...
Rocket Man Posted November 22, 2013 Report post Posted November 22, 2013 Yeah sure create the package (source files) as mentioned without doing it through SCCM. Place them on a network share anywhere and simply browse to the share and execute the batch file. Just to ammend the previous example I would also recommend putting in the %~dp0 syntax as you are running it from a share, so the batch file will look something like this: msiexec /i "%~dp0SupportTools.msi" /qbping -n 11 127.0.0.1copy " %~dp0NameofShortcut.lnk" "C:\Users\Public\Desktop" Also I forgot to mention that the batch file also needs to be in the source files package along with the executable and shortcut! Hope this helps... 1 Quote Share this post Link to post Share on other sites More sharing options...
Atomic12 Posted November 22, 2013 Report post Posted November 22, 2013 Thank you once again, I read about the dp0 syntax but scripting is currently in a unknown outer space domain for me. I tried in my Win 7 VM your first suggestion and it worked, but just to be sure I will ad the %~dp0 line. Have a nice weekend. Quote Share this post Link to post Share on other sites More sharing options...
wimvv Posted November 25, 2013 Report post Posted November 25, 2013 To make the installation more reliable how about some extra code before copying ? Wait for msiexec installation to complete before returning the prompt back with the start /wait method start /wait msiexec /i "%~dp0SupportTools.msi" /qb copy " %~dp0NameofShortcut.lnk" "C:\Users\Public\Desktop" or when you like to use ping but want to make sure the source for the shortcut has been placed. msiexec /i "%~dp0SupportTools.msi" /qb set counter=0 :loop ping -n 1 127.0.0.1 set /A counter+=1 rem Timeout if %counter% GTR 11 goto :OutOfLoop rem Exit if install file found if filexist "C:\Program Files (x86)\SupportTools\SupportTools.exe" goto :OutOfLoop goto :loop :OutOfLoopcopy "NameofShortcut.lnk" "C:\Users\Public\Desktop" or something like that. Cheers Quote Share this post Link to post Share on other sites More sharing options...
Atomic12 Posted November 25, 2013 Report post Posted November 25, 2013 Hi, it worked like a charm! After 13 Deployments of trying it finally worked Thank you Rocket Man, Also thank you wimvv, your code is too advanced for me in this moment but I appreciate it, maybe I will use the code in the near future. Bye, Quote Share this post Link to post Share on other sites More sharing options...