city_skyline

Now, before you get all upset, this is really a prototype to demonstrate ONE possible way to do something which isn’t normally supported (use at your own risk, batteries not included).

So, the point here is that Microsoft Intune is a flexible, and capable tool, even if it has some hair-brained management consoles to contend with.  But it is somewhat limited on how it can deploy software to a Windows desktop device (or laptop, tablet. not talking phones here).  You can deploy an .appx, .msi or .exe file, and that’s about it.

With ConfigMgr, on the other hand, you can deploy almost anything, probably including a kitchen sink with dishes and stinky water, if you wanted to.  So…

Background

One common challenge in the crazy world of software deployment is having to deploy things other than packaged applications.  For example, Access database files, raw data files, creating folders and shoving files into them, creating custom shortcuts, and so on.  Granted, much of this can be done using other means (AdminStudio repackaging, InstallShield packaging, and even Group Policy, to name a few).  But this is only a demonstration and not intended to be a recommendation for how to do things.  I’m showing one particular wrench, so if you prefer a hammer, use a hammer.

Goal

Deploy a copy of the beloved CMTrace.exe log viewer to a Windows machine, using Intune.  Place the exe into a designated folder.  Create a desktop shortcut to the exe for all users.

Ingredients

Three (3) files in all: install.bat, install.vbs and the CMTrace.exe file.  CMTrace.exe is included with System Center Configuration Manager server installations, and can be found under the “tools” sub-folder below the main installation path.  Be sure you are properly licensed for ConfigMgr before you start copying any of its files around.

ip0

(ignore “InstallCMTrace.exe” for now. I’ll explain that one later)

I used a Windows 10 Professional computer, and the ancient (and still included with Windows) iexpress.exe packager utility.  Okay, it’s not really a packager, but if you drink enough you can pretend it is.

Script 1 – Install.bat

@echo off
set log=%temp%\intune_cmtrace.log
echo info: moving cmgtrace.exe to c:\users\public\documents... >%log%
move %~dp0CMTrace.exe C:\Users\Public\Documents\
if exist "c:\users\public\documents\cmtrace.exe" (
  echo info: file moved successfully. >>%log%
  goto GOOD
) else (
  echo error: file was not moved! >>%log%
  goto END
)

:GOOD
echo info: calling script to create shortcut... >>%log%
cscript /nologo install.vbs >>%log%
echo info: finished processing. >>%log%
goto END

:END

Script 2- Install.vbs

Sub MakeShortcut(caption, target, wpath, icon, wintype, tip, where)
  Dim objShortcut, objShell
  Set objShell = CreateObject("WScript.Shell")
  If where <> "" Then
    wscript.echo "info: creating shortcut..."
    wscript.echo "info: target = " & target
    wscript.echo "info: caption = " & caption
    wscript.echo "info: working path = " & wpath
    wscript.echo "info: shortcut path = " & where
    Set objShortcut = objShell.CreateShortcut(where & "\" & caption & ".lnk")
    objShortcut.TargetPath = target
    objShortcut.WorkingDirectory = wpath
    objShortcut.IconLocation = icon
    objShortcut.WindowStyle = wintype
    objShortcut.Description = tip
    objShortcut.Save
    If err.Number = 0 Then
      wscript.echo "info: shortcut created successfully"
    Else
      wscript.echo "error: failed to create shortcut"
    End If
  Else
    wscript.echo "error: shortcut location path was not specified"
  End If
End Sub

MakeShortcut "CMTrace", "C:\Users\Public\Documents\CMTrace.exe", _
  "C:\Users\Public\Documents", _
  "C:\Users\Public\Documents\CMTrace.exe", _
  vbNormal, "CMTrace", "C:\Users\Public\Desktop"

Create the Package

Basically, you select the three (3) files and specify some options and create a new .exe at the end.  That .exe is actually a self-extracting archive file which will contain the script files and the CMTrace.exe.

  1. Launch “iexpress.exe” any way you prefer
    ip12
    Select the first option…
    ip1
    Provide a Name…ip2
    ip3
    ip4
    Select the files to deliver…
    ip5
    Select “install.bat” in the drop-down list, but modify the statement to include “cmd /c” in front (or the execution later will fail)…
    ip6
    ip7
    ip8
    Specify the folder path and filename to save the new .exe.  I named this one “InstallCMTrace.exe”…
    ip9
    ip10
    You can save the .sed file if you want, which can be helpful for editing / modifying…
    ip11
    Click Next to create the package.  You will see a CMD console appear and it will invoke makecab.exe and then close…
    ip12
  2. You should now have four (4) files in the folder, unless you selected a different output location.  If you saved a .sed file, that will also show up.ip0

    Recommendation:  TEST this package locally, before proceeding!  Run it using the local SYSTEM account (i.e. open a CMD console using psexec /s, etc. and invoke the .exe)

  3. Log into the Intune Tenant Administrator console
    it01
  4. Select Apps, then click on Apps and click “Add App”.  You may be prompted to login again within the popup window.
  5. Select “Software Installer” and “Windows Installer (*.exe, *.msi)” and click Browse.  Select the .exe you created and click Open. (Note: since this is a bundled file, you don’t need to check the box for additional files).  Click Next
    it02
  6. Specify the Publisher, Name, and enter a Description.  Select a Category, if desired. If you have a PNG or JPG to use for a portal image (icon), click Browse.  Otherwise, click Next.
    it03
  7. For this example, leave the Architecture and Operating System Requirements settings alone, and click Next.
    it04
  8. Click “Add Rule” and select “File exists” from the drop-down list, and click the Add button just below it.  Specify the path as shown below (just for the example). Click Next.
    it05
  9. Select “No” on Command Line Arguments, and click Next.
    it06
  10. Select “Yes” on Return Code options.  I chose “No” just for the heck of it.
    it07
    it09
    it10
    it11
    Click Close, when finished.
    Tip: The final package should be around 294.33 KB in size.
  11. If you didn’t already create (or designated) a target Group, select Groups and create a new Group.
  12. Select the App you just created, and click “Manage Deployment”.  Select the Group to target, and finish up.

When the app has been deployed to a computer, you should see a new desktop shortcut named “CMTrace” with the icon of the app .exe itself (a computer tower, with a notebook beside it).  In addition, you should find the CMTrace.exe itself under C:\Users\Public\Documents, and a trace log file under the system %temp% folder (e.g. \Windows\Temp) or the user’s %temp% folder.

What Else?

This concept is obviously very limited in capability.  However, it could be adapted for use in performing hybrid App deployments with Intune to Windows desktop computers, whereby the installation content is hosted from an on-premises host (server, share).  This would only be an option to consider if you do NOT have ConfigMgr in place, as this is a band-aid idea.

Some examples where this might be helpful (again: if you don’t have System Center ConfigMgr) could include such bloated installations as Adobe Creative Suite, Autodesk Infrastructure and Building Design Services, and Esri ArcGIS products.  Then again, if your ExpressRoute setup has bodaciously-gnarly amounts of bandwidth and no limits, you can ignore all of this.  But you still would need consider your storage limits (20 GB by default, but you can buy more), and slower download speeds than pulling content from a server within your environment.

Thoughts?

Let me know what you think?  Is this brilliant?  Or is this stupid as hell?  I’d love to hear your thoughts and experiences on this.

Advertisements

One thought on “Deploying CMTrace using Microsoft Intune

Leave a Reply

Please log in using one of these methods to post your comment:

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