Jump to content


Recommended Posts

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 off
msiexec /i "D:\packages\Support Tools 4.1.0\SupportTools.msi"/qb
ping -n 11 127.0.0.1 > nul
xcopy /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,

post-22178-0-98976300-1385126197_thumb.jpg

post-22178-0-40780900-1385126201_thumb.jpg

post-22178-0-20620600-1385126204_thumb.jpg

post-22178-0-88968900-1385126206_thumb.jpg

Share this post


Link to post
Share on other sites

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" /qb
ping -n 11 127.0.0.1
copy "NameofShortcut.lnk" "C:\Users\Public\Desktop"

 

That should do the trick!

  • Like 1

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites

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" /qb
ping -n 11 127.0.0.1
copy " %~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...

  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

 

:OutOfLoop
copy "NameofShortcut.lnk" "C:\Users\Public\Desktop"

 

or something like that.

 

Cheers

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...