Sccm 2012 - Adding shortcut in the desktop and scripting

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
petrosygAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TLeading EngineerCommented:
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
petrosygAuthor Commented:
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
Mike TLeading EngineerCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

RobSampsonCommented:
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
Mike TLeading EngineerCommented:
Thanks Rob, that's what I meant to write too ;).
0
petrosygAuthor Commented:
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
petrosygAuthor Commented:
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
petrosygAuthor Commented:
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
Mike TLeading EngineerCommented:
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
petrosygAuthor Commented:
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
RobSampsonCommented:
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
petrosygAuthor Commented:
Thank you Both, Great Solution!!!
0
RobSampsonCommented:
No problem, glad we could help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Server Software

From novice to tech pro — start learning today.