So over the weekend i was reviewing some posts up on the Facebook groups for SCCM and i can across this blog around sharing a link to the AppCatalog which also references this blog which details the actual creation of the application string. Which for me looks great as it resolves a big bug bear i have had where i couldn’t share the link to customers, a comment on the Blog post questioned where the right click tool was for this, which got me thinking i can do that.
I’ve added a few lines of code to Nick’s code which gets the encoded string, pops up a new draft email from Outlook (sorry if you have notes. no no really I’m so so sorry if you have to live with lotus notes) along with Copying the string to the clip board.
The added code is:
$ol = New-Object –comObject Outlook.Application
$mail = $ol.CreateItem(0)
$mail.BodyFormat = 2
$mail.Subject = “How to Install $appnamestring“
$mail.Body = $appstring
$inspector = $mail.GetInspector
$appname = $args
Import-Module ($env:SMS_ADMIN_UI_PATH).Replace(“i386”, “ConfigurationManager.psd1”)$sitecode = ((gwmi –Namespace root\ccm –Class SMS_Authority).Name.split(“:”))
$scopeidlong = (Get-CMApplication –Name $appname).CI_UniqueID
$scopeid = $scopeidlong.split(“/”) + “/” +$scopeidlong.split(“/”)
$encoded = encode($scopeid)
$appcat = (gwmi –Namespace root\ccm\LocationServices –Class SMS_PortalInformation).Url
$encoded = $appcat + “/#/SoftwareCatalog/AppDetails/” + $encoded
sendemail $encoded $appname
Add-Type –AssemblyName ‘System.Windows.Forms’
The first part of the script is a function to create an email, then we handle the Arguments coming into the script and launch, and importing the SCCM 2012 PowerShell module from your computer. Then we get the sitecode and connect to path.
Now we are connected to your site in PowerShell we will get the CI_UniqueID for the application you are looking for, which is then split to remove the version number off the end, then we Encode the string using Nick’s code which we then get the AppCatalog’s URL to provide a full path for the email which is created next, then copies the code to ClipBoard.
So I have created a simple zip file which you can download from my OneDrive here
Please let me know if you find any issues.