Deployment with Microsoft Intune (Windows)
This guide gives the necessary steps to deploy the SenseOn Universal Sensor to Windows devices with Microsoft Intune. For macOS devices, refer to Deployment with Microsoft Intune (macOS).
Recommended: Deploy via the SenseOn Install Command
The simplest method to deploy with Intune is to put the SenseOn PowerShell install command in a wrapper script. Then deploy the script as a Win32 app. This method always installs the latest published version of the Universal Sensor. It is not necessary to package an MSI.
Step 1: Copy your install command
- Log in to SenseOn.
- Go to Settings > Universal Sensor.
- Copy the Windows install command. The command has this structure:
$env:SENSEON_INSTALLER_KEY="<your-installer-key>"; iwr -useb https://<your-tenant>.senseon.io/install.ps1 | iex
Optional: Verify the install script checksum
It is possible that your security policy makes a checksum check necessary before you run remote scripts. If so, do a check of the script on your admin workstation before you create the package:
# Step 1: Download the script Invoke-WebRequest -UseBasicParsing -Uri "https://<your-tenant>.senseon.io/install.ps1" -OutFile install.ps1 # Step 2: Verify the checksum (compare against the value shown in Settings > Universal Sensor) Get-FileHash install.ps1 -Algorithm SHA256If the two hash values are the same, the script is genuine. In Step 2, replace the
Invoke-WebRequest ... | Invoke-Expressionline with the contents of theinstall.ps1file that you examined. Keep the$env:SENSEON_INSTALLER_KEYline in its position.
Step 2: Create the install script
Save the script that follows as Install.ps1 in a folder, for example C:\Temp\SenseOn. Replace <your-installer-key> and <your-tenant> with the values from your install command:
# SenseOn install script for Intune (Win32 app).
# Wraps the SenseOn install command with a 64-bit relaunch and error handling so
# that Intune reliably reports success or failure.
# Intune runs Win32 install commands in 32-bit PowerShell, but the installer requires
# a 64-bit host. Relaunch this script in 64-bit PowerShell if we are running 32-bit.
if ([Environment]::Is64BitOperatingSystem -and -not [Environment]::Is64BitProcess)
{
$sysNativePwsh = "$env:WINDIR\SysNative\WindowsPowerShell\v1.0\powershell.exe"
# If the 64-bit host cannot be found, fail rather than falsely report success.
if (-not (Test-Path $sysNativePwsh))
{
exit 10
}
try
{
& $sysNativePwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -WindowStyle Hidden -File "$PSCommandPath"
$childExit = $LASTEXITCODE
}
catch
{
exit 11
}
# A failed relaunch can leave no exit code; treat that as a failure, not success.
if ($null -eq $childExit)
{
exit 12
}
exit $childExit
}
$ErrorActionPreference = "Stop"
$exitCode = 0
try
{
$env:SENSEON_INSTALLER_KEY = "<your-installer-key>"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -UseBasicParsing -Uri "https://<your-tenant>.senseon.io/install.ps1" |
Invoke-Expression
# Preserve the exit code from the SenseOn install script.
$exitCode = $LASTEXITCODE
if ($null -eq $exitCode)
{
$exitCode = 0
}
}
catch
{
Write-Error $_ -ErrorAction Continue
if ($exitCode -eq 0)
{
$exitCode = 1
}
}
exit $exitCode
This wrapper script is more reliable than the install command alone in two areas:
- 64-bit relaunch. Intune starts Win32 install commands in 32-bit PowerShell, and the installer rejects 32-bit PowerShell. The script detects this condition and starts itself again in 64-bit PowerShell.
- Accurate status reporting. The script sends the exit code of the installer to Intune. Thus Intune reports a real failure as a failure, not as a false success. Exit codes
10,11and12show a problem with the 64-bit relaunch.
Step 3: Package the script with the Intune Win32 Content Prep Tool
Use the same Microsoft Win32 Content Prep tool as in the legacy procedure, with these values:
- Source folder:
C:\Temp\SenseOn - Setup file:
Install.ps1 - Output folder:
C:\Temp
You upload the output .intunewin package to Intune.
Step 4: Configure the Win32 app in Intune
- Open the Endpoint Manager portal.
- Go to Apps > Windows > Add.
- Select Windows app (Win32).
- Upload your
.intunewinpackage. -
Configure the app with these values:
- Install command:
powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File Install.ps1 - Uninstall command:
powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "Get-Package -Name 'senseon-bootstrapper' | Uninstall-Package -Force" - Install behaviour: System
- Operating system architecture: 64-bit
- Minimum operating system: Windows 10 1903 (or later, if necessary)
The uninstall command removes the bootstrapper, not the sensor. On Windows, when you uninstall the bootstrapper MSI, the services of the Universal Sensor stop immediately. But the uninstall only schedules the removal of the sensor package. That removal runs the next time an administrator logs on to the device. On a device that nobody logs on to, for example a server, the sensor package stays installed until then. To remove the two packages in the same run, add the uninstall script to the source folder before you make the package. Then use
powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File uninstall_senseon.ps1as the uninstall command. The deferred removal is a behaviour of the Windows MSI and is not a rule for all platforms. Thus on macOS and Linux, obey Uninstalling SenseOn. If you uninstall only the sensor, the bootstrapper stays installed and installs the sensor again. 6. Set the Detection rule to a Registry rule: - Key path:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\senseon-bootstrapper- Value name: (leave blank) - Detection method: Key existsThis rule detects the SenseOn bootstrapper service, which this package installs. The bootstrapper then downloads and installs the Universal Sensor. Because the rule detects the bootstrapper and not the sensor binary, Intune is responsible only for the item that it deploys. If the bootstrapper installs but the sensor does not show, the cause is usually a local antivirus, DNS, or TLS interception problem. A new installation cannot correct such a problem. You see those problems when the device does not check in to SenseOn (refer to Step 5). You do not see them when Intune tries the installation again. 7. Assign the app to the applicable Azure AD group of target devices.
- Install command:
Step 5: Verify deployment
After Intune reports the app as installed on a device:
- Log in to SenseOn.
- Go to Assets > Devices.
- Make sure that the device shows with a recent Last Seen timestamp.
If the device does not show, refer to Troubleshooting.