Introduction
Since VMware started the rollout of Freestyle Orchestrator in the SAAS environments, it is possible to use the sensor functionality.
By default, Workspace One UEM collects multiple device attributes and displays them in the UEM console. These are, for example, attributes such as Operating System info, Patches/Updates, applications and certificates.
Using sensors, it is possible to create custom sensors that collect data and display this data in the Workspace One UEM console or can be used for automation in Workspace One intelligence. This makes it possible to collect attributes specific to your environment to display within the console or use for advanced automations.
At the moment it is possible to use sensors for the following operating systems:
- macOS
- Windows
- Linux
For this blog I focus on the Windows sensors. These collect their data based on PowerShell scripts and can be executed from the User or System context. A choice can be made based on the data to be collected. You can also choose from various execution architectures (32-bit (forced), 32-bit, 64-bit and Auto).
During the assignment process of a Windows sensor it is possible to determine the trigger. This trigger determines when the sensor data is collected. This can be based on a schedule (Data sample interval) or based on an event such as:
- Login
- Log Out
- Startup
- User Switch
The sensors can be configured in this location in the Workspace One UEM console. As you can see, there are no sensors present by default.
Import your first sensors
To get started quickly with the Windows sensors, an online repository is available. These sensors can be downloaded and imported with a PowerShell script. This is done through the UEM API.
The example sensors and script can be found here: euc-samples/UEM-Samples/Sensors/Windows at master · vmware-samples/euc-samples · GitHub. There are also a number of templates available that help you to easily create sensors yourself.
You can make a selection of your desired sensors and import them automatically. This takes a few minutes and the process looks like this:
As you can see, the sensors are imported and automatically assigned to the required smart group.
Create your own sensors
After the first sensors have been imported, it is time to create your own sensors. In my case I made 4 more custom sensors. The scripts for these sensors are shown below.
- Check if specific file exists
# Returns if file exist
# Execution Context = System
# Exection Arcitecture = Auto
# Response Data Type = Boolean
$ShortcutExist = Test-Path C:\ProgramData\AirWatch\Staging\Scripts\Shortcut.ps1
Write-Output $ShortcutExist
- Check the status of the Windows Update Service
# Returns status of service (Stopped/Running etc.)
# Execution Context = System
# Execution Architecture = Auto
# Response Data Type = String
$WindowsUpdateService = Get-service wuauserv
Write-Output $WindowsUpdateService.Status
- Check last boot time of Windows device
# Returns last boot time
# Executionm Context = System
# Execution Architecture = Auto
# Response Data Type = String
$LastBootTime = Get-CimInstance -ClassName Win32_OperatingSystem
Write-Output $LastBootTime.LastBootupTime
- Check for last run time of a Scheduled task
# Returns Last Run Time of specified Scheduled Task
# Run as System
# Execution Architecture = Auto
# Response Data Type = String
$LastRunTime = Get-ScheduledTaskInfo "\VMware\SfdAgent\Software Distribution Queue Task" | select LastRunTime
Write-Output $LastRunTime
The following steps show how to configure a sensor manually in the Workspace One UEM console:
- Navigate to Resources/Sensors and select Add –> Windows
2. Give the sensor a name. The name must be between 2-64 characters and only using a combination of lowercase letters, numbers and underscores.
3. Select the Language, Execution Context/Architecture and Reponse type and insert the PowerShell code and click Save & Assign.
4. Select New Assignment
5. Give the assignment a name and select the appropiate Smart Group.
6. Finally select the trigger for the sensor and click Save.
View Sensor data in Workspace One UEM Console
To view the collected sensor data in the Workspace One UEM console you have to navigate to Devices/List View. Here you can select your device and select the Sensors tab.
Using device sensor data in Workspace One Intelligence
As mentioned before it is also possible to use the collected sensor data in Workspace One Intelligence. As you see in this screenshot the sensors are also available in Workspace One Intelligence. You can use this to create your own dashboards or automation workflows.
Troubleshooting Sensors
If a sensor does not show any data, this can be due to the following reasons:
• The device does not have the specific attribute that the PowerShell script is looking for
• There is an error in the script
• The Response Data Type is not configured correctly
• The context is not configured correctly
• Execution Architecture is not configured correctly
From the Troubleshooting tab of the selected Windows device you can find out why no data is shown for a specific sensor.