Skip to content

Commit

Permalink
Revert "Revert "Merge branch 'master' of https://github.com/vmwaresam…
Browse files Browse the repository at this point in the history
…ples/AirWatch-samples""

This reverts commit 1f8859c.
  • Loading branch information
Andreano Lanusse committed Apr 29, 2019
1 parent cd9bec2 commit 12638c0
Show file tree
Hide file tree
Showing 30 changed files with 1,183 additions and 36 deletions.
Expand Up @@ -23,6 +23,5 @@ Deploy the .bat file via AirWatch's Product Provisioning.
## Change Log
- 8/1/2017: Created Samples for creating/deleting/modifying users and their permissions


## Additional Resources
* [Net User Reference](https://technet.microsoft.com/en-us/library/cc771865(v=ws.11).aspx)
84 changes: 80 additions & 4 deletions Windows-Samples/Sensors/README.md
@@ -1,19 +1,95 @@
# Workspace ONE Sensors

## Overview
- **Authors**:Bhavya Bandi, Varun Murthy, Josue Negron, Brooks Peppin, Aaron Black, Mike Nelson
- **Email**: bbandi@vmware.com, vmurthy@vmware.com, jnegron@vmware.com, bpeppin@vmware.com, aaronb@vmware.com, miken@vmware.com
- **Authors**:Bhavya Bandi, Varun Murthy, Josue Negron, Brooks Peppin, Aaron Black, Mike Nelson, Chris Halstead, Justin Sheets
- **Email**: bbandi@vmware.com, vmurthy@vmware.com, jnegron@vmware.com, bpeppin@vmware.com, aaronb@vmware.com, miken@vmware.com, chalstead@vmware.com, jsheets@vmware.com
- **Date Created**: 11/14/2018
- **Supported Platforms**: Workspace ONE 1811
- **Updated**: 4/26/2019
- **Supported Platforms**: Workspace ONE 1811+
- **Tested on**: Windows 10 Pro/Enterprise 1803+

## Purpose
These Workspace ONE Sensor samples contain PowerShell command lines or scripts that can be used in a **Provisioning > Custom Attributes > Sensors** payload to report back information about the Windows 10 device back to Workspace ONE.

## Description
There are Sensor samples, templates, and a script `import_sensor_samples.ps1` to populate your environment with all of the samples.

## Required Changes/Updates
None
You will want to leverage the `template_` samples and modify any of the data, or leverage the existing samples. You can also leverage the `import_sensor_samples.ps1` script to upload the samples to your environment. Only the templates and the Sensor Importer require changes. Samples work as is, but can also be modified for your needs.

### WMI Query Template
$wmi=(Get-WmiObject WMI_Class_Name)
write-output $wmi.Attribute_Name

### Registry Value Template
$reg=Get-ItemProperty "HKLM:\Key Folder\Key Name"
write-output $reg.ValueName

## Workspace ONE Sensors Importer

### Synopsis
This Powershell script allows you to automatically import PowerShell scripts (Sensor Samples) as Workspace ONE Sensors in the Workspace ONE UEM Console. MUST RUN AS ADMIN

### Description
Place this PowerShell script in the same directory of all of your samples (.ps1 files) or use the `-SensorsDirectory` parameter to specify your directory. This script when run will parse the PowerShell sample scripts, check if they already exist, then upload to Workspace ONE UEM via the REST API.

### Examples

- **Basic**: this command shows all required fields and will scan the default directory and upload the samples to Workspace ONE via the REST API using the credentials provided.

.\import_sensor_samples.ps1 `
-WorkspaceONEServer "https://as###.awmdm.com" `
-WorkspaceONEAdmin "administrator" `
-WorkspaceONEAdminPW "P@ssw0rd" `
-WorkspaceONEAPIKey "YeJtOTx/v2EpXPIEEhFo1GfAWVCfiF6TzTMKAqhTWHc=" `
-OrganizationGroupName "techzone"

- **Custom Directory**: using the `-SensorsDirectory` parameter tells the script where your samples exist. The directory provided must have .ps1 files which you want uploaded as Sensors.

.\import_sensor_samples.ps1 `
-WorkspaceONEServer "https://as###.awmdm.com" `
-WorkspaceONEAdmin "administrator" `
-WorkspaceONEAdminPW "P@ssw0rd" `
-WorkspaceONEAPIKey "YeJtOTx/v2EpXPIEEhFo1GfAWVCfiF6TzTMKAqhTWHc=" `
-OrganizationGroupName "techzone" `
-SensorsDirectory "C:\Users\G.P.Burdell\Downloads\Sensors"

- **Assign to Smart Group**: using the `-SmartGroupID` parameter will assign ALL Sensors which were uploaded and that already exist to that chosen Smart Group. *Existing Smart Group memberships will be overwritten!* This command is used best in a test environment to quickly test Sensors before moving Sensors to production. Obtain the Smart Group ID via API or by hovering over the Smart Group name in the console and looking at the ID at the end of the URL.

.\import_sensor_samples.ps1 `
-WorkspaceONEServer "https://as###.awmdm.com" `
-WorkspaceONEAdmin "administrator" `
-WorkspaceONEAdminPW "P@ssw0rd" `
-WorkspaceONEAPIKey "YeJtOTx/v2EpXPIEEhFo1GfAWVCfiF6TzTMKAqhTWHc=" `
-OrganizationGroupName "techzone" `
-SmartGroupID 14

### Parameters
**WorkspaceONEServer**: Server URL for the Workspace ONE UEM API Server e.g. https://as###.awmdm.com without the ending /API. Navigate to **All Settings -> System -> Advanced -> Sites URLs**.
![](https://i.imgur.com/et8Tm5h.png)


**WorkspaceONEAdmin**: An Workspace ONE UEM admin account in the tenant that is being queried. This admin must have the API role at a minimum.

**WorkspaceONEAdminPW**: The password that is used by the admin specified in the admin parameter

**WorkspaceONEAPIKey**: This is the REST API key that is generated in the Workspace ONE UEM Console. You locate this key at **All Settings -> System -> Advanced -> API -> REST API**,
and you will find the key in the API Key field. If it is not there you may need override the settings and Enable API Access.
![](https://i.imgur.com/tQqsyzw.png)

**OrganizationGroupName**: The Group ID of the Organization Group. You can find this by hovering over your Organization's Name in the console.
![](https://i.imgur.com/lWjWBsF.png)

**SensorsDirectory**: (OPTIONAL) The directory your .ps1 sensors samples are located, default location is the current PowerShell directory of this script.

**SmartGroupID**: (OPTIONAL) If provided, all sensors in your environment will be assigned to this Smart Group. Existing assignments will be overwritten. Navigate to **Groups & Settings > Groups > Assignment Groups**. Hover over the Smart Group, then look for the number at the end of the URL, this is your Smart Group ID.
![](https://i.imgur.com/IjvkoGC.png)


## Change Log
- 4/26/2019 - Force use of TLS 1.2 for REST API Calls; fixed minor issues
- 12/6/2018 - Added more details on how to use import_sensor_samples.ps1
- 12/5/2018 - Added import_sensor_samples.ps1 and updated system_type, system_status, system_date, templates, system_family
- 12/3/2018 - added system_pc_type, system_status, system_family, system_type, system_thermal_state, system_wakeup_type, system_model, system_manufacturer, system_hypervisor_present, system_dns_hostname, system_username, system_name, system_domain_role, system_domain_membership, system_domain_name
- 11/30/2018 - added os_verison, os_build_version, os_build_number, os_architecture, os_edition, system_timezone, bitlocker_encryption_method, horizon_broker_url, horizon_protocol, template_get_wmi_object, template_get_registry_value
- 11/21/2018 - updated bios_secure_boot and bios_serial_number
Expand Down
2 changes: 1 addition & 1 deletion Windows-Samples/Sensors/bios_secure_boot.ps1
@@ -1,6 +1,6 @@
# Returns True/False if Secure Boot is Enabled or Disabled
# Return Type: Boolean
# Execution Context: Admin
# Execution Context: System
try { $bios=Confirm-SecureBootUEFI }
catch { $false }
Write-Output $bios
Expand Down
2 changes: 1 addition & 1 deletion Windows-Samples/Sensors/bios_status.ps1
@@ -1,5 +1,5 @@
# Returns the BIOS Status
# Statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicting a failure in the near future). Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states.
# Statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicting a failure in the near future). Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other Systemistrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states.
# Return Type: String
# Execution Context: User
$bios=Get-WmiObject Win32_bios -ComputerName $env:computername -ea silentlycontinue
Expand Down

0 comments on commit 12638c0

Please sign in to comment.