Sccm 2012 - Adding shortcut in the desktop and scripting

Posted on 2014-02-28
Medium Priority
Last Modified: 2014-03-09
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 "http://ora-app.abcdefg.com:7778/forms/frmservlet?config=abcdefg"
 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
Question by:petrosyg
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
LVL 18

Assisted Solution

by:Mike T
Mike T earned 1336 total points
ID: 39897272

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 deployment.properties 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: http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Q_28271216.html.

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.


Author Comment

ID: 39897738

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
LVL 18

Accepted Solution

Mike T earned 1336 total points
ID: 39897947

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. http://www.giannistsakiris.com/2008/12/03/how-to-create-shortcuts-in-windows-from-the-command-line/
or powershell, here: http://stackoverflow.com/questions/9701840/how-to-create-a-shortcut-using-powershell-or-cmd


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: http://www.deploymentresearch.com/Research/tabid/62/EntryId/23/Back-to-the-basics-Copying-a-folder-in-MDT-2010.aspx

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.

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

LVL 65

Assisted Solution

RobSampson earned 664 total points
ID: 39898209
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 "http://ora-app.abcdefg.com:7778/forms/frmservlet?config=abcdefg"
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

LVL 18

Expert Comment

by:Mike T
ID: 39898411
Thanks Rob, that's what I meant to write too ;).

Author Comment

ID: 39898694
Mike and Rob,

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


Author Comment

ID: 39903785

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

Author Comment

ID: 39906471
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
LVL 18

Expert Comment

by:Mike T
ID: 39907119

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:





Author Comment

ID: 39907386

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
LVL 65

Expert Comment

ID: 39908460
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.



Author Closing Comment

ID: 39916594
Thank you Both, Great Solution!!!
LVL 65

Expert Comment

ID: 39916608
No problem, glad we could help.

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever stumbled upon a software that is so great that you just love? It happened to me. Love at first sight. Filezilla Server.   Ok its not the most advanced ftp server I've came across. But its a fairly simple piece of software to get the …
Preface There are many applications where some computing systems need have their system clocks running synchronized within a small margin and eventually need to be in sync with the global time. There are different solutions for this, i.e. the W3…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question