Creating Shortcuts for SCCM Packages

Some applications don’t have proper ‘installers’. Also, some applications with no silent install option work fine if the folder contents are simply copied to another system. When packages are created in this manner, it’s necessary to create start menu shortcuts and register file extensions manually. This post provides scripts to do so.

Creating Shortcuts

The following is a Powershell script created with the help of Nick Ciereck @ win1337ist. To use it, modify lines 36 and 41-44. Sorry that it’s so crude; this is essentially a working draft. I’ll post version 2 when it’s ready.

#####
#This script sets up the CrystalMaker shortcuts in the 'all users' start menu.
####

Function Read-EnvVariable($varName)
	{
		$varName = "ProgramData"
		#This function reads any environment variable passed by "varName" and returns it.
		$oVariable = gci env: | where {$_.Name -eq $varName}
		$strValue = $oVariable.Value

		$retval = $strValue
		Return $retval
	}

Function Create-Shortcut($pathToExe,$destinationPath,$iconPath)
	{

		If($iconPath -eq $null)
			{$iconPath = ($pathToExe + ",0")}

		$shell = New-Object -ComObject ("WScript.Shell")
		$shortcut = $shell.CreateShortcut($destinationPath)
		$shortcut.TargetPath = $pathToExe
		$shortcut.IconLocation = $iconPath
		$shortcut.Save()

		##close shell somehow
	}

#declare the shortcut entries collection
$aShortcutEntries = @()

##get some variables needed
$programDataPath = Read-EnvVariable "ProgramData"
$ChemistryAppsPath = ($programDataPath + "\Microsoft\Windows\Start Menu\Programs\Chemistry Applications\")

#declare specific shortcut entries
##ref: http://technet.microsoft.com/en-us/library/ff730946.aspx
$shortcutEntry = New-Object System.Object
$shortcutEntry | Add-Member -type NoteProperty -name PathToExe -value "C:\Program Files (x86)\OSU Chemistry\Chemistry Video Player\VideoPlayer.exe"
$shortcutEntry | Add-Member -type NoteProperty -name Name -value "Chemistry Video Player.lnk"
$shortcutEntry | Add-Member -type NoteProperty -name destinationPath -value ($ChemistryAppsPath + $shortcutEntry.Name)
$shortcutEntry | Add-Member -type NoteProperty -name iconPath -value "C:\Program Files (x86)\OSU Chemistry\Chemistry Video Player\video.ico"
$aShortcutEntries += $shortcutEntry
$shortcutEntry = $null

#make the target directory if needed
if( (Test-path $ChemistryAppsPath) -eq $false )
	{
		New-Item $ChemistryAppsPath -type directory
	}

#make the shortcuts
$aShortcutEntries | % {
	$pathToExe = $_.PathToExe
	$destinationPath = $_.destinationPath
	$iconPath = $_.IconPath

	##example: Create-Shortcut "C:\g09w\gview.exe" ($programDataPath + "\Microsoft\Windows\Start Menu\Programs\Chemistry Applications\GaussView.lnk")
	Create-Shortcut $pathToExe $destinationPath $iconPath
}

Creating File Extensions

Creating file extensions in a batch file is easy.
For each file type run the following command:

  • assoc .<extension1>=<programName>Document
  • assoc .<extension2>=<programName>Document
  • assoc .<extension3>=<programName>Document

Next, run the following command to tie all the extensions together:

  • ftype <programName>Document=”<pathToEXE>” “%1”

If you’re putting this in a batch file, remember to escape the percent sign with a second percent sign. Here is an example of a complete batch script:

REM Associations
assoc .dsf=DiamondDocument
assoc .diamdoc=DiamondDocument
assoc .ds1=DiamondDocument
ftype DiamondDocument="C:\Program Files (x86)\Diamond 3\Diamond.exe" "%%1"

I hope this helps someone. Thanks! John

Advertisements

19 thoughts on “Creating Shortcuts for SCCM Packages

  1. Pingback: SCCM Package – Casa XPS 2.3.16 « windowsmasher

  2. Pingback: SCCM Package – Diamond 3.2g « windowsmasher

  3. Pingback: SCCM Package – Gaussian 09W « windowsmasher

  4. Pingback: SCCM Package – Gaussview 5 « windowsmasher

  5. Pingback: SCCM Package – HyperChem 8 « windowsmasher

  6. Pingback: SCCM Package – JMOL « windowsmasher

  7. Pingback: SCCM Package – MathCAD 15 « windowsmasher

  8. Pingback: SCCM Packages – Mathematica 8 « windowsmasher

  9. Pingback: SCCM Packages – Matlab R2011b « windowsmasher

  10. Pingback: SCCM Package – MDL Isis Draw 2.5 « windowsmasher

  11. Pingback: SCCM Package – Molecular Workbench « windowsmasher

  12. Pingback: SCCM Packages – Pasco DataStudio « windowsmasher

  13. Pingback: SCCM Packages – Putty « windowsmasher

  14. Pingback: SCCM Package – Spartan 10 « windowsmasher

  15. Pingback: SCCM Package – Vensim 5.11a « windowsmasher

  16. Pingback: MATLAB R2012a silent install « srikanthyellow

  17. Pingback: Table of Contents | windowsmasher

  18. Pingback: cigarettes sale - buy online smokes

  19. Pingback: MATLAB R2012a silent install | Srkanth Yellow

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s