Solved

Sccm 2012 - Adding shortcut in the desktop and scripting

Posted on 2014-02-28
13
4,191 Views
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
image-1.JPG
image-2.JPG
0
Comment
Question by:petrosyg
  • 6
  • 4
  • 3
13 Comments
 
LVL 16

Assisted Solution

by:Mike T
Mike T earned 334 total points
ID: 39897272
Hi,

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.

thanks,
Mike
0
 

Author Comment

by:petrosyg
ID: 39897738
Mike

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
0
 
LVL 16

Accepted Solution

by:
Mike T earned 334 total points
ID: 39897947
Hi,

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


Example

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.

Mike
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 166 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.

Regards,

Rob.

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"
Else
	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
Wend
objIE.Quit 

Function GetOSArchitecture(objRemote)
	' TITLE: GetOSArchitecture
	' DESCRIPTION: This function will use a WMI query to determine the system
	'	architecture of the target computer
	' INPUT:
	'	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
	' OUTPUT:
	'	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
    Next
    If intAddressWidth = "32-bit" Then intAddressWidth = 32
    If intAddressWidth = "64-bit" Then intAddressWidth = 64
    GetOSArchitecture = intAddressWidth
End Function

Open in new window

0
 
LVL 16

Expert Comment

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

Author Comment

by:petrosyg
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.

Petros
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:petrosyg
ID: 39903785
Rob,

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
0
 

Author Comment

by:petrosyg
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
0
 
LVL 16

Expert Comment

by:Mike T
ID: 39907119
Hi,

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:

http://blog.coretech.dk/mip/creating-and-using-toolkit-package/

http://blogs.technet.com/b/deploymentguys/archive/2012/07/06/finish-actions-for-configuration-manager-osd.aspx

http://blogs.technet.com/b/mniehaus/archive/2012/08/24/copying-oem-files-and-folders-with-mdt-2012-update-1.aspx

Mike
0
 

Author Comment

by:petrosyg
ID: 39907386
Mike,

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

Expert Comment

by:RobSampson
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):
AdobeReaderTS1
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.

Regards,

Rob.
0
 

Author Closing Comment

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

Expert Comment

by:RobSampson
ID: 39916608
No problem, glad we could help.
0

Featured Post

Want to promote your upcoming event?

Attending an event? Speaking at a conference? Or exhibiting at a tradeshow? Easily inform your contacts by using a promotional banner in your email signature. This will ensure your organization’s most important contacts are in the know.

Join & Write a Comment

Introduction People like FTP.  It's a solid, stable, robust protocol for quickly transferring files between two hosts using TCP/IP.  In most cases it's much faster than SMB or CIFS, and certainly much easier to set up between organizations.  This…
If, like me, you have a lot of Dell servers in the estate you manage this article should save you a little time. When attempting to login to iDrac on any server I would be presented with two errors. The first reads "Do you want to run this applicati…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now