Sccm 2012 - Adding shortcut in the desktop and scripting

petrosyg used Ask the Experts™
We have been using ZENWorks and we have our 2012 R2 SCCM Site up and running ... So far so good... now, I am working on packaging about 50 Applications.
I have one application that I am having issues with. (if you can call it an application it is a shortcut placed on desktop and it opens an IE browser - it uses the jave JRE).
I will describe how it is done in Zen and may be someone can help me achieve my goal.
In advance Thank you all for everything thing that you do, it is greatly appreciated.
The first time I deploy the Application -
1. Install (Install Tab In Zen)
 •Install Java 1.6
 •Reg Edit
 •Edit Deployement.Properties Text File Win7
 •Edit Deployement.Properties Text File WinXP
Example: See image 1
2. Launch (Launch Tab in Zen)
I run the following Actions: they run a vbScript
Run IE Start Script os=32  --- Path (%SYSTEMROOT%\system32\cscript.exe)
Run IE Start Script os=64  --- Path (%SYSTEMROOT%\SYSWOW64\cscript.exe)
The actual Script is the following
Dim objIE
 Set objIE = WScript.CreateObject ("InternetExplorer.Application")
 ObjIE.Width = 1024
 ObjIE.Height = 815
 ObjIE.Toolbar = false
 objIE.Navigate ""
 objIE.Visible = true
See Image 2
Also, in Zen I am able to Edit the Icon and tell it to go to each user's desktop and startup folder (list) fairly easily - i believe the controls are given. I know I will need to create a script,  copy the Icon to the local System etc... but if someone can tell me some ways of achieving this, I will greatly appreciate it.

Attached Images
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mike TLeading Engineer

It is perfectly possible. You have to create a software package and process (run) the steps in a task sequence and then deploy the task sequence to machines.

1) do the main install
2) Install Java 1.6
 3) Edit the registry using standard command line reg but use /s so it's silent
4) Create two deployment types - one for win 7 one for XP, to use pre-prepared files
you could create them on the fly but it's easier to use templates for each OS.
5) run the script with %SYSTEMROOT%\system32\cscript.exe Oraclex86.vbs
or %SYSTEMROOT%\SYSWOW64\cscript.exe Oraclex64.vbs

You set step 5 to run different scripts by using a WQL condition on two steps in the task-sequence.
See my answer for similar solution:

Summary: you can run anything as a deployment with SCCM; if you can run it manually you can you run it with SCCM the same way as long as you keep everything "silent", i.e. use /quiet or /s as appropriate.




Thank you for your help I will review it thoroughly tonight and try it.

I always thought of using TS during OS deployment.

Also how do I address the shortcut?

Thank you
Leading Engineer

It's seen as being for OSD but you can use it whatever you like.
For the shortcut either do a simple copy file or create the shortcut using the command line using a script - e.g.
or powershell, here:


copy a file
xcopy.exe "%deployroot%\Test\*.lnk" "c:\Test" /Q /H /E /I /Y

Note the %deployroot% is a special path to your MDT deployment package. See here for a better way to copy files:

Note you need to install MDT and run the integration step. Running ConfigMgr without MDT is like eating bananas and custard, without the bananas!

Good luck. It's good stuff when it works. Check the logs AppEnforce.log and SMSTS.log if things don't quite work. Let me know if you need any more help.

Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Most Valuable Expert 2012
Top Expert 2014
Mike has all the steps covered here, so you should be able to get something going.  What I would generally do is have your Task Sequence run a VBS script that does the following:
1. Set your Task Sequence to have a working directory with the script and application files in it
2. Execute your silent Java install
3. Modify the registry
4. Identify OS architecture and deploy appropriate template file from working directory
5. Run the IE browser
6. Copy a shortcut from the working directory to the Public Desktop

The following script is untested, but should be a decent start to getting this done.



strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

strArchitecture = GetOSArchitecture(objWMIService)

Set objShell = CreateObject("WScript.Shell")
objShell.Run """.\jre-7u51-windows-i586.exe"" /s /v/qn"" IEXPLORER=1 NETSCAPE6=0 MOZILLA=0 REBOOT=Suppress JAVAUPDATE=0 WEBSTARTICON=0""", 1, True

Set objFSO = CreateObject("Scripting.FileSystemObject")

If strArchitecture = 32 Then
	objShell.RegWrite "HKLM\Software\JavaSoft\Java Update\Policy\EnableJavaUpdate", 0, "REG_DWORD"
	objShell.RegWrite "HKLM\Software\JavaSoft\Java Update\Policy\NotifyDownload", 0, "REG_DWORD"
	' Modify other 32 bit reg keys as appropriate
	' Copy the template file and shortcut
	objFSO.CopyFile ".\Deployment.Properties(x86)", "C:\Program Files\Java\Deployment.Properties"
	objFSO.CopyFile ".\Shortcut(x86).lnk", "C:\Users\Public\Desktop\Shortcut.lnk"
	objShell.RegWrite "HKLM\Software\Wow6432Node\JavaSoft\Java Update\Policy\EnableJavaUpdate", 0, "REG_DWORD"
	objShell.RegWrite "HKLM\Software\Wow6432Node\JavaSoft\Java Update\Policy\NotifyDownload", 0, "REG_DWORD"
	' Modify other 64 bit reg keys as appropriate
	' Copy the template file and shorcut
	objFSO.CopyFile ".\Deployment.Properties(x64)", "C:\Program Files (x86)\Java\Deployment.Properties"
	objFSO.CopyFile ".\Shortcut(x64).lnk", "C:\Users\Public\Desktop\Shortcut.lnk"
End If

' Run the browser
Dim objIE
Set objIE = WScript.CreateObject ("InternetExplorer.Application")
objIE.Width = 1024
objIE.Height = 815
objIE.Toolbar = false
objIE.Navigate ""
objIE.Visible = True
While objIE.ReadyState <> 4 Or objIE.Busy = True
	WScript.Sleep 100

Function GetOSArchitecture(objRemote)
	' TITLE: GetOSArchitecture
	' DESCRIPTION: This function will use a WMI query to determine the system
	'	architecture of the target computer
	'	objRemote must be an object that is bound to the WMI service on the target machine
	'	Make a call such as Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
	'	and pass objWMI to this function
	'	A string value being 32 or 64
	Set colOS = objRemote.ExecQuery("SELECT OSArchitecture FROM Win32_OperatingSystem",, 48) 
    For Each objOS In colOS 
        intAddressWidth = objOS.OSArchitecture
    If intAddressWidth = "32-bit" Then intAddressWidth = 32
    If intAddressWidth = "64-bit" Then intAddressWidth = 64
    GetOSArchitecture = intAddressWidth
End Function

Open in new window

Mike TLeading Engineer

Thanks Rob, that's what I meant to write too ;).


Mike and Rob,

Thank you both for all your help, I am working on it right now and I will report back asap.




I have been trying to use the script and I am not getting errors but I am having hard time trying to complete  it.

I made few notes below, I have been playing with TaskSeq. and I am able to deploy packages, some that have a pre request of some kind etc ...

My weakness is in scripting ...and that said, I took a break from looking at it yesterday and I want to visit it again today.

a.   pretty much everything is done with in the script - does that mean I do not have to create any packages that will do specific things?  - Individual packages (with scripts)?
b.   I did not see where the script addresses weather it is an XP or Win 7os; I see that it addresses  32bit and 64 bit os
c.   If I client has Java already installed, will the TS fail trying to reinstall that same java client?

I know you and Mike simplified the steps and the first time I went through it, it made perfect sense. When it was time to implement the steps, I just got mentally locked.

I will give it a try again this afternoon and I will let you know.

Thank you again


Mike /Rob,

Ok   I am getting close I think ....

I got all the pieces ready, few simple things I am trying are the following:

I have all my scripts, files, icons and shortcuts etc in one folder (sub folder of my App folder), how do I Set the Task Sequence to have a working directory?

Also how will the TS steps  would look like if I just have the one Script?

I guess all the TS related items that I have worked has those multiple steps and I think somehow i am having a hard time bypassing it.

Thank you guys
Mike TLeading Engineer


To create a package you can create just a folder and copy it locally or nest in the MDT package. The advantage here is that MDT is referred to by %deployroot% so you can easily script new things using %deployroot%\ChromeFix or whatever you like as time goes on.

Think of it as kind of sysvol where login scripts used to live, only this has logging and far more control.

Here's an example or three of using deployroot:




Thank you again and I will try to get a better understanding.

If you do not mind, and it is ok with you can I send you an email?

My email address is  ********* @ live.c o m

If that is not ok, pls ignore my request.

Thank you
Most Valuable Expert 2012
Top Expert 2014

In my MDT installation, I don't use "Packages".  I just use "Applications", and script the installs similar to what I have shown.  I guess one potential major difference is that I really only use mine for new software installs, and not version upgrades or uninstalls.

As an example, when I install Adobe Reader, my task sequence properties are this (set up as an application with source files):
and in that Silent_Install.vbs, I have this code
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objShell.Run "msiexec /i ""AcroRead.msi"" /qn /norestart", 1, True
objShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Policies\Adobe\Acrobat Reader\11.0\FeatureLockdown\bUpdater", 0, "REG_DWORD"
objFSO.CreateFolder "C:\Program Files (x86)\Adobe\Thumbnail Fix"
objFSO.CopyFile objShell.CurrentDirectory & "\Thumbridge.exe", "C:\Program Files (x86)\Adobe\Thumbnail Fix\Thumbridge.exe"
objFSO.CopyFile objShell.CurrentDirectory & "\Thumbridge32.dll", "C:\Program Files (x86)\Adobe\Thumbnail Fix\Thumbridge32.dll"
objFSO.CopyFile objShell.CurrentDirectory & "\Thumbridge64.dll", "C:\Program Files (x86)\Adobe\Thumbnail Fix\Thumbridge64.dll"
objShell.Run "cmd /c ""C:\Program Files (x86)\Adobe\Thumbnail Fix\Thumbridge.exe"" /regserver", 1, True
objShell.Run "cmd /c regsvr32.exe /s ""C:\Program Files (x86)\Adobe\Thumbnail Fix\Thumbridge32.dll""", 1, True
objShell.Run "cmd /c regsvr32.exe /s ""C:\Program Files (x86)\Adobe\Thumbnail Fix\Thumbridge64.dll""", 1, True

Open in new window

So using the script I posted (or slightly changed if it doesn't work right), in this way, you should be able to get a working install.




Thank you Both, Great Solution!!!
Most Valuable Expert 2012
Top Expert 2014

No problem, glad we could help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial