Lab 7: Device management
Objectives and Tasks
Sensors and Scripts
- Create a sensor for Windows Desktop devices.
- Create a script for Windows Desktop devices.
- Create and assign a device tag.
Task 1: Create a sensor for Windows Desktop devices
You create a sensor that will report the OS build version for a Windows Desktop device.
In the upper-right corner of the console, click the drop-down menu with your administrator name and verify that Student{labid} organization group is selected from the Organization Group drop-down menu.
- From the menu at the top, seelct Resources.
- Expand Scripting in the navigation menu on the left, and select Sensors.
- If you get a "What can I do with sensors?" screen, click Get Started.
- Click Add and select Windows from the dropdown menu.
- Enter
os_build_number{labid}as the sensor name. Click Next. - From the Language dropdown, select Powershell.
- Set the Execution Context to System.
- For Execution Architecture, select Auto.
- Select String from the Response Data Type.
- Paste the following code into the Code window.
# Description: Returns Windows version e.g. 2009
# Execution Context: SYSTEM
# Execution Architecture: EITHER64OR32BIT
# Return Type: STRING
$releaseID = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId
return $releaseID
- Click Save & Assign.
- Click New Assignment.
- Name the assignment
Windows Desktop Devices. - Type
Windowsin the search for Smart Group box, and wait for the assignment groups to appear. - Select Windows Desktop Devices.
- Click Next.
- For Trigger Type, select Schedule. This will report the results of the sensor during the configured Intelligent Hub data sample interval.
- Click Save.
- Click Close.
- To check the sensor value, click Devices in the navigation menu at the top.
- Select Devices in the navigation on the left.
- Click on the friendly name of one of your Windows Desktop devices.
- Select the Sensors tab and look for the sensor name os_build_number{labid}.
If the sensor value is blank, it might indicate that Intelligent Hub has not yet synced with the Workspace ONE UEM console. You can force the device to sync by clicking the Query button from the Action Menu in the console.
Task 2: Create a script for Windows Desktop devices
You create a script to run disk cleanup on a Windows Desktop device.
In the upper-right corner of the console, click the drop-down menu with your administrator name and verify that Student{labid} organization group is selected from the Organization Group drop-down menu.
- Fromt he menu at the top, select Resources.
- Expand Scripting in the navigation menu on the left, and select Scripts.
- If you see a "What can I do with scripts?" screen, click Get Started.
- Click Add and select Windows from the dropdown menu.
- Enter
disk_cleanup{labid}as the script name. eave the App Catalog Customization disabled. Click Next. - From the Language dropdown, select Powershell.
- Set the Execution Context & Privileges to System Context.
- For Execution Architecture, select Auto.
- Enter
30for the Timeout value. - Paste the following script into the Code window.
# Description: This script runs disk cleanup
# Execution Context: SYSTEM
# Execution Architecture: EITHER64OR32BIT
# Timeout: 30
$groupnumber = 64
$enable = 2
$disable = 0
$RootKey = "Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
#The following subkeys are documented here https://ss64.com/nt/cleanmgr-registry.html
$keys = @(
'Active Setup Temp Folders'
'BranchCache'
'Content Indexer Cleaner'
'Delivery Optimization Files'
'Diagnostic Data Viewer database Files'
'D3D Shader Cache'
'Downloaded Program Files'
'Downloads Folder'
'Internet Cache Files'
'Language Pack'
'Offline Pages Files'
'Old ChkDsk Files'
'Recycle Bin'
'RetailDemo Offline Content'
'ServicePack Cleanup'
'Setup Log Files'
'System error memory dump files'
'Temporary Files'
'Update Cleanup'
'User file versions'
'Thumbnail Cache'
'Windows Defender'
'Windows Error Reporting Files'
'Windows Upgrade Log Files'
)
$name = "StateFlags0000"
function Invoke-setRegKey {
param([Parameter(Mandatory=$true)][string]$key)
$path = "$RootKey\$key"
$test = Test-Path -Path $path
if($test){
New-ItemProperty -Path $path -Name $name -Value $enable -PropertyType "DWord" -Force
} else {
write-host "Unable to find $path"
}
}
function Invoke-clearRegKey {
param([Parameter(Mandatory=$true)][string]$key)
$path = "$RootKey\$key"
$test = Test-Path -Path $path
if($test){
New-ItemProperty -Path $path -Name $name -Value $disable -PropertyType "DWord" -Force
} else {
write-host "Unable to find $path"
}
}
#Enable Cleanup Manager Settings
foreach ($key in $keys){
Invoke-setRegKey -key $key
}
# Run Disk Cleanup without showing any user interface
Start-Job -Name Cleanup -ScriptBlock {cleanmgr.exe /sagerun:$groupnumber}
Wait-Job -Name Cleanup
foreach ($key in $keys){
Invoke-clearRegKey -key $key
}
Remove-Job -Name Cleanup
write-host "Successfully run Cleanup Manager, resetting settings" -ForegroundColor Green
Exit 0
- Click Next.
- Click Save.
- In the Scripts list, check the new script you just created, and click Assign.
- Click New Assignment. Name the assignment
Windows Desktop Devices. - Type
Windowsin the search for Smart Group box, and wait for the assignment groups to appear. - Select Windows Desktop Devices.
- Click Next.
- Check Run Once Immediately.
- Click Add.
- Click Save & Publish, and then click Publish.
Task 3: Create and assign a device tag
You create a tag in the Workspace ONE UEM console and assign the tag to a device
In the upper-right corner of the console, click the drop-down menu with your administrator name and verify that Student{labid} organization group is selected from the Organization Group drop-down menu.
select Groups & Settings from the top navigation. Then, expand All Settings in the navigation pane on the left and navigate to Devices & Users > Advanced > Tags.
Select Create Tag.
Enter
Sales teamin the Name field.Click Save.
In the navigation at the top, click Devices. Then, select Devices from the navigation menu on the left.
Click on the friendly name of one of your Windows Desktop devices.
Click on the More Actions menu, and select Manage Tags.
Under the Available Tags, select Sales team to add the tag to the device.
Select Devices from the navigation menu on the left to return to the Devices List View.
Check the Tags column next to your device to see if the tag has been assigned.
0 Comments
Add your comment