Deployment with Group Policy (GPO)
You can deploy the SenseOn Universal Sensor with Group Policy only. Use this method if you have Active Directory but no Intune, Configuration Manager, or other endpoint management tool. This guide tells you how to deploy to domain-joined Windows devices with a computer startup script. It also gives an alternative that installs the sensor and does not wait for a reboot.
Do not use Group Policy Software Installation. The Software Installation node in Group Policy accepts only an MSI. The node cannot pass the installer key of your tenant to that MSI. A script installs SenseOn, and the script reads the key from an environment variable. Thus the deployment must run that script. The two supported methods are a startup script and a scheduled task. The Windows packages of SenseOn are MSI files. But the install script downloads and runs them with your key at the time of installation. Thus there is no package that you can put in Software Installation.
Endpoints with no direct internet. You can use this method for devices that cannot connect directly to the internet. The devices must be able to connect to the SenseOn install URL and telemetry endpoints through a proxy. Configure the installer to use the proxy. Make sure that the sensor continues to use the same proxy during operation. Deploying through a proxy gives the two procedures. This method cannot get to a host that has no outbound path, through a proxy or by other means. For that host, refer to If you must pre-install on the golden image.
Before You Start
These items are necessary:
- The rights to create and link a Group Policy Object, and to write to a domain share.
- Your Windows install command and installer key from Settings > Universal Sensor.
- Target devices that can connect to the SenseOn install and telemetry endpoints. For the related domains, refer to Endpoint Requirements. If your estate uses a proxy, refer to Proxy Configuration.
- An organisational unit (OU) or a security group that contains the computer accounts of the target devices.
Treat the installer key as a secret. The key enrols each device that gives it. Ordinary users must not be able to read a script that contains the key. Each authenticated user can read the
NETLOGONshare, so that share is not applicable in most environments. Choose where the script lives gives the safer option. If a key is not secret anymore, rotate it in Settings > Universal Sensor. When you rotate the key, the previous key becomes invalid. Update your script before you rotate the key. If you do not, pending installations will stop with an error.
Option 1: Deploy with a Computer Startup Script
Startup scripts run as SYSTEM before a user signs in. Thus the installation has the necessary privileges and does not depend on which user is logged on.
Step 1: Create the install script
Group Policy runs a startup script at each boot. If the SenseOn install command runs again on a device that has SenseOn, the command can stop with an error. It does not always complete as a no-op. Thus the script that follows first does a check for SenseOn. If SenseOn is present, the script exits. As a result, it is safe to keep the script linked for an unlimited time.
Save the script as Install-SenseOn.ps1. Replace the placeholders with your tenant hostname and installer key:
<#
Installs the SenseOn Universal Sensor if it is not already present.
Intended to run as a Group Policy computer startup script (runs as SYSTEM).
#>
$ErrorActionPreference = "Stop"
$logDir = Join-Path $env:ProgramData "SenseOnDeploy"
if (-not (Test-Path $logDir)) { New-Item -Path $logDir -ItemType Directory -Force | Out-Null }
$log = Join-Path $logDir "Install-SenseOn.log"
function Write-Log($message) {
"$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $message" | Out-File -FilePath $log -Append -Encoding utf8
}
# Already installed? The bootstrapper is the service which installs and maintains the
# sensor, so its presence is the reliable test. Exit quietly so the next boot is cheap.
if (Get-Service -Name "senseon-bootstrapper" -ErrorAction SilentlyContinue) {
Write-Log "senseon-bootstrapper present, nothing to do."
exit 0
}
# Older Windows builds negotiate TLS 1.0 by default, which the download will refuse.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
try {
Write-Log "Starting SenseOn install."
$env:SENSEON_INSTALLER_KEY = "<your-installer-key>"
Invoke-WebRequest -UseBasicParsing -Uri "https://<your-tenant>.senseon.io/install.ps1" | Invoke-Expression
Write-Log "Install command completed."
exit 0
}
catch {
Write-Log "Install failed: $($_.Exception.Message)"
exit 1
}
The script writes to C:\ProgramData\SenseOnDeploy\Install-SenseOn.log on each device. If a device does not show in the platform, examine this log first.
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 deploy:
Invoke-WebRequest -UseBasicParsing -Uri "https://<your-tenant>.senseon.io/install.ps1" -OutFile install.ps1 Get-FileHash install.ps1 -Algorithm SHA256Compare the hash with the value shown next to the command in Settings > Universal Sensor. If the two values are the same, replace the
Invoke-WebRequest ... | Invoke-Expressionline inInstall-SenseOn.ps1with the contents of the script that you examined. Keep the$env:SENSEON_INSTALLER_KEYline before it.
Step 2: Choose where the script lives
The script contains your installer key. Thus the location of the script is important.
| Location | Who can read it | Use it? |
|---|---|---|
The GPO's own Machine\Scripts\Startup folder |
Domain Admins and, by default, Authenticated Users. You can restrict the ACL to Domain Computers and Domain Admins only. | Recommended. The folder stays with the GPO, and you can restrict access to it. |
The NETLOGON share |
Every authenticated user in the domain | Do not use it unless you accept that each signed-in user can read the key. |
To use the GPO's own folder:
- Open the GPO in the Group Policy Management Editor.
- Go to the startup scripts setting that Step 3 describes.
- Select Show Files.
- Copy
Install-SenseOn.ps1into the folder that opens.
This folder is the Machine\Scripts\Startup folder in the directory of the GPO in SYSVOL.
After the file is in position, restrict who can read it. Remove Authenticated Users from the ACL of the file. Then give read access to Domain Computers and Domain Admins. Read access for Domain Computers is important, because the computer account reads a startup script. The signed-in user does not read it.
Note: If Domain Computers keeps read access, a stricter ACL on the file has no effect on Group Policy processing. If you also remove that access, devices do not run the script, and they show no error.
Step 3: Create and link the GPO
- Open Group Policy Management on a domain controller, or on a workstation that has the Remote Server Administration Tools installed.
- Right-click the OU that contains your target computer accounts and select Create a GPO in this domain, and Link it here.
- Give the GPO a name that you can recognise, for example
Deploy SenseOn Universal Sensor. - Right-click the new GPO and select Edit.
- Go to Computer Configuration > Policies > Windows Settings > Scripts (Startup/Shutdown).
- Double-click Startup.
- Select Show Files.
- Put the script in the folder that opens. Step 2 gives the procedure.
- Stay in the Startup properties. On the Scripts tab, select Add. Then enter these values:
- Script Name:
powershell.exe - Script Parameters:
-ExecutionPolicy Bypass -NoProfile -File "%~dp0Install-SenseOn.ps1"
- Script Name:
- Select OK to close the properties.
Why the Scripts tab rather than the PowerShell Scripts tab. The PowerShell Scripts tab runs your script with the effective execution policy of the machine. Thus a restrictive policy stops the installation. To prevent that, this procedure calls
powershell.exefrom the Scripts tab with-ExecutionPolicy Bypass. If your estate already sets an execution policy that lets signed or local scripts run, you can use the PowerShell Scripts tab. That tab is also slightly tidier.
Step 4: Make sure the network is ready
A startup script can run before the network stack is ready, and the installation must download from your tenant. If you do not do this step, the first boot after you link the GPO often does not install SenseOn. Then the installation occurs only on a later boot.
In the same GPO, enable the two settings that follow:
- Computer Configuration > Policies > Administrative Templates > System > Logon > Always wait for the network at computer startup and logon.
- Computer Configuration > Policies > Administrative Templates > System > Group Policy > Specify startup policy processing wait time. Set a value that is applicable to your estate, for example 60 seconds.
Also examine Computer Configuration > Policies > Administrative Templates > System > Scripts > Maximum wait time for Group Policy scripts. The default is 600 seconds for all startup scripts together. The SenseOn installation usually completes in much less time than that. But if you run several startup scripts, make sure that the time is sufficient.
Deploying through a proxy
A startup script runs as SYSTEM before a user signs in. SYSTEM does not get the proxy that a signed-in user has. Thus a proxy that operates when you run the install command manually can be absent when Group Policy runs the same command. Then the download does not work, and the cause is not clear. On endpoints that connect to SenseOn only through a proxy, give that proxy to the installer explicitly. Do not rely on the machine to find the proxy.
The install script has a -Proxy host:port option. This option sends the download of the install script and the first contact of the bootstrapper through an HTTP CONNECT proxy. On Universal Sensor 7.0.50 and later, the option also saves that proxy to the proxy.json file of the sensor. As a result, the sensor also uses the proxy during operation.
On earlier versions, the sensor reads only proxy.json during operation. Thus an endpoint that is fully offline must have the option and the file. For the option, refer to Installing Through or Around a Proxy. For the proxy.json format, refer to Proxy Configuration.
Use this version of Install-SenseOn.ps1. Set $Proxy to the proxy of the site in host:port form:
<#
Installs the SenseOn Universal Sensor through a proxy.
Runs as a Group Policy computer startup script (SYSTEM).
#>
$ErrorActionPreference = "Stop"
$Proxy = "proxy.process.local:3128" # the site's proxy, host:port
$InstallerKey = "<your-installer-key>"
$Tenant = "<your-tenant>.senseon.io"
$logDir = Join-Path $env:ProgramData "SenseOnDeploy"
if (-not (Test-Path $logDir)) { New-Item -Path $logDir -ItemType Directory -Force | Out-Null }
$log = Join-Path $logDir "Install-SenseOn.log"
function Write-Log($m) { "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $m" | Out-File $log -Append -Encoding utf8 }
if (Get-Service -Name "senseon-bootstrapper" -ErrorAction SilentlyContinue) {
Write-Log "senseon-bootstrapper present, nothing to do."
exit 0
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$script = Join-Path $env:TEMP "install.ps1"
try {
# The script's own download must also go through the proxy.
Write-Log "Downloading install script through $Proxy."
Invoke-WebRequest -UseBasicParsing -Uri "https://$Tenant/install.ps1" -OutFile $script -Proxy "http://$Proxy"
Write-Log "Running install through $Proxy."
$env:SENSEON_INSTALLER_KEY = $InstallerKey
& powershell.exe -ExecutionPolicy Bypass -NoProfile -File $script -Proxy $Proxy
if ($LASTEXITCODE -ne 0) { throw "install.ps1 exited $LASTEXITCODE" }
# Give the running sensor its own proxy for ongoing telemetry.
$bootstrapperDir = Join-Path $env:ProgramData "senseon-bootstrapper"
if (-not (Test-Path $bootstrapperDir)) { New-Item -Path $bootstrapperDir -ItemType Directory -Force | Out-Null }
$parts = $Proxy.Split(":")
@{ proxy_host = $parts[0]; proxy_port = [int]$parts[1] } | ConvertTo-Json -Compress |
Out-File (Join-Path $bootstrapperDir "proxy.json") -Encoding ascii
Write-Log "Install complete, proxy.json written."
exit 0
}
catch {
Write-Log "Install failed: $($_.Exception.Message)"
exit 1
}
Why the script also writes
proxy.json. On Universal Sensor 7.0.50 and later,-Proxysaves the proxy toproxy.jsonfor the sensor to use during operation. Thus the last step writes the same value again. Earlier versions use-Proxyonly for installation and the first fetch of the bootstrapper. For those versions, a separate step must write the file. The script keeps the step so that it works on earlier and later versions.
Deploying
proxy.jsonon its own. If you do not want the script to write the file, use a Group Policy Preferences file item (Computer Configuration > Preferences > Windows Settings > Files). Deploy the file to%ProgramData%\senseon-bootstrapper\proxy.json. Deploy the file at the same time as the installation, or before it. Then the sensor has a proxy from the first start.
The path differs on a host with no bootstrapper. The script in this section and the file item write to the path of the bootstrapper. A device that you deploy with this method reads that path. An older host that has only the sensor, and no bootstrapper, does not read that path. That host must have
C:\ProgramData\senseon-see\proxy.json. For the two paths, refer to Proxy Configuration.
Make sure that each proxy that you use has permission to connect to the SenseOn install and telemetry endpoints. Connectivity Requirements lists these endpoints. If the proxy cannot connect to them, the installation does not work, even when the endpoint can connect to the proxy.
Different proxies per site
If each site has its own proxy, you have two options:
- Make a copy of this GPO for each site. Put the
$Proxyvalue of the site in the copy, and link the copy to the OU of the site. - Use one script that tries each candidate proxy in sequence. The script installs through the first proxy that works and saves that proxy.
For the second option, replace the download, install, and proxy.json steps in the proxy version of the script with this code:
$Proxies = @("site-a-proxy:3128", "site-b-proxy:3128", "site-c-proxy:3128")
$working = $null
foreach ($p in $Proxies) {
try {
Invoke-WebRequest -UseBasicParsing -Uri "https://$Tenant/install.ps1" -OutFile $script -Proxy "http://$p" -TimeoutSec 30
$env:SENSEON_INSTALLER_KEY = $InstallerKey
& powershell.exe -ExecutionPolicy Bypass -NoProfile -File $script -Proxy $p
if ($LASTEXITCODE -eq 0) { $working = $p; Write-Log "Installed via $p."; break }
}
catch { Write-Log "Proxy $p did not work, trying the next." }
}
if (-not $working) { Write-Log "No proxy in the list worked."; exit 1 }
# Save the proxy that worked so the running sensor keeps using it.
$bootstrapperDir = Join-Path $env:ProgramData "senseon-bootstrapper"
if (-not (Test-Path $bootstrapperDir)) { New-Item -Path $bootstrapperDir -ItemType Directory -Force | Out-Null }
$parts = $working.Split(":")
@{ proxy_host = $parts[0]; proxy_port = [int]$parts[1] } | ConvertTo-Json -Compress |
Out-File (Join-Path $bootstrapperDir "proxy.json") -Encoding ascii
Write-Log "proxy.json written for $working."
The check for an installed SenseOn at the top of the script makes it safe to keep this script linked. If a device cannot connect to a proxy that works until a later boot, the device completes the installation at that boot.
How the proxy is saved
An endpoint keeps a single proxy setting for its continuous connection. proxy.json contains this setting. The endpoint does not store a list, and it does not go through several proxies in sequence at run time. Thus the script selects the proxy one time, during installation.
The loop tries each candidate in sequence. When one candidate is successful, the loop immediately writes that one proxy into proxy.json. After that, the sensor uses the saved proxy during operation, and the script does not specify it again. As a result, the deployment resolves the differences between sites and saves the result for each device.
On Universal Sensor 7.0.50 and later, the -Proxy option also writes its value to proxy.json at the time of installation. Thus the write by the script repeats the value. On earlier versions, -Proxy applies only to the installation and the first contact of the bootstrapper. The script writes proxy.json with the same value, and this keeps that proxy for the sensor after installation. To change the proxy of a device later, edit or replace its proxy.json, as Proxy Configuration describes. As an alternative, deploy again with a different value.
Step 5: Apply the policy
Startup scripts run only at boot. Restart the target device. As an alternative, first refresh the policy on the target device with this command, then restart the device:
gpupdate /target:computer /force
Devices show in Assets > Devices in a few minutes after the script runs.
Option 2: Deploy Without Waiting for a Reboot
To enrol devices without a restart, use a Group Policy Preferences immediate task, not a startup script. The task runs one time, a short time after the next policy refresh of the device. Then the task deletes itself.
- Put
Install-SenseOn.ps1on a share that Domain Computers can read. The reasons are the same as in Step 2. A dedicated share with a restricted ACL is applicable here. The reason is that a Preferences task cannot use the scripts folder of the GPO. - In the GPO, go to Computer Configuration > Preferences > Control Panel Settings > Scheduled Tasks.
- Right-click and select New > Immediate Task (At least Windows 7).
- On the General tab:
- Set Action to
Create. - Under Security options, select Change User or Group. Enter
SYSTEM, then confirm the entry. - Select Run with highest privileges.
- Set Action to
- On the Actions tab, add a Start a program action with these values:
- Program/script:
powershell.exe - Add arguments:
-ExecutionPolicy Bypass -NoProfile -File "\\<your-domain>\<share>\Install-SenseOn.ps1"
- Program/script:
- On the Common tab, select Apply once and do not reapply.
The task runs at the next policy refresh. By default, the refresh occurs in 90 minutes or less. The task also runs immediately after you run gpupdate /target:computer /force on a target device.
Use both together. A common method is to use the immediate task to enrol the devices that you have today. Keep the startup script linked to enrol devices that you build or re-image later. Because of the check for an installed SenseOn in the script, the two methods cannot conflict.
Verifying the Deployment
- Log in to SenseOn.
- Go to Assets > Devices.
- Make sure that your target hosts show with their expected hostnames and a recent Last Seen timestamp.
On one device, make sure that the two SenseOn services are present and that they run:
Get-Service senseon-bootstrapper, senseon-seed
senseon-bootstrapper installs and maintains the sensor. senseon-seed is the sensor. If the bootstrapper runs but the sensor is not present, wait approximately ten minutes. Then do the check again. The bootstrapper installs the sensor a short time after enrolment.
If Devices Do Not Appear
Do these steps in sequence:
- Make sure that the policy reached the device. Run
gpresult /r /scope:computeron a target device. Make sure that the applied policy objects include the GPO. If they do not, examine the GPO link and the security filtering on the GPO. Also examine the OU membership of the computer account. - Examine the deployment log. Look at
C:\ProgramData\SenseOnDeploy\Install-SenseOn.log. If the log records a failure, the script ran, and policy delivery is not the cause. If there is no log, the script did not run. - Make sure that the computer account can read the script. If you restricted the ACL, make sure that Domain Computers still has read access. If the computer cannot read the script, there is no log.
- Do a check of connectivity. From the device, make sure that it can connect to your tenant. Refer to Endpoint Requirements. TLS inspection must have a bypass for the SenseOn domains.
- Examine the installer key. If you rotated the key after you wrote the script, the installation does not work. Copy the current command from Settings > Universal Sensor.
- Get verbose output. Refer to Troubleshooting: Running the Install Script in Verbose Mode.
Removing SenseOn
First unlink or delete the GPO. If you do not, the startup script installs the agent again at the next boot. Then remove the agent as Uninstalling SenseOn describes. That page includes the PowerShell uninstall script. It is safe to run that script more than one time. Thus you can deploy it with the same methods as the installer: a startup script or an immediate task.
Remove the bootstrapper as well as the sensor. While the bootstrapper is installed, it installs the Universal Sensor again if the sensor is missing. This usually occurs in approximately ten minutes. The uninstall script removes the two packages in the correct sequence.