Skip to content

Commit

Permalink
Added Workspace ONE Sensor samples
Browse files Browse the repository at this point in the history
Signed-off-by: Josue Negron <jnegron@vmware.com>
  • Loading branch information
josuenegron committed Nov 15, 2018
1 parent c6574ea commit 3315a82
Show file tree
Hide file tree
Showing 28 changed files with 185 additions and 0 deletions.
1 change: 1 addition & 0 deletions Windows-Samples/README.md
Expand Up @@ -6,6 +6,7 @@ This section of the **AirWatch-samples** repository contains samples relating to
Some examples of items to submit for consideration and use by the community:

- Custom XML Profile Payloads (use [VMware Policy Builder](https://VMwarePolicyBuilder.com) for easy Windows 10 Custom XML generation)
- Workspace ONE Sensors Samples
- Scripts for Product Provisioning
- Scripts to use as helpful tools

Expand Down
23 changes: 23 additions & 0 deletions Windows-Samples/Sensors/README.md
@@ -0,0 +1,23 @@
# Custom Attributes

## Overview
- **Authors**: Robert Terakedis, John Richards
- **Email**: rterakedis@vmware.com, jrichards@vmware.com
- **Date Created**: 6/8/2017
- **Supported Platforms**: AirWatch version 9.0
- **Tested on macOS Versions**: macOS El Capitan, macOS Sierra

## Purpose
These sample custom attributes contain command lines or scripts that can be used in a Custom Attribute payload to report back information about macOS to AirWatch.

## Required Changes/Updates
None

## Change Log
- 6/8/2017: Created Initial File
- 7/20/2017: Cleanup and added more CA's
- 2/1/2018: Added more CA's


## Additional Resources
None
11 changes: 11 additions & 0 deletions Windows-Samples/Sensors/battery_charging_status.ps1
@@ -0,0 +1,11 @@
# Returns "Charging" or "Not Charging" if the battery is charging or not
# Return Type: String
# Execution Context: User
$charge_status = (Get-CimInstance win32_battery).batterystatus
$charging = @(2,6,7,8,9)
if($charging -contains $charge_status[0] -or $charging -contains $charge_status[1] )
{
echo "Charging"
}else{
echo "Not Charging"
}
@@ -0,0 +1,5 @@
# Returns the estimated remaining charge on the battery
# Return Type: Integer
# Execution Context: User
$battery_remain=(Get-WmiObject win32_battery).estimatedChargeRemaining | Measure-Object -Average | Select-Object -ExpandProperty Average
echo $battery_remain
6 changes: 6 additions & 0 deletions Windows-Samples/Sensors/battery_max_capacity.ps1
@@ -0,0 +1,6 @@
# Returns the max charge capacity of the batteries
# Return Type: Integer
# Execution Context: User
$max_capacity = (Get-WmiObject -Class "BatteryFullChargedCapacity" -Namespace "ROOT\WMI").FullChargedCapacity | Measure-Object -Sum | Select-Object -ExpandProperty Sum
echo $max_capacity

6 changes: 6 additions & 0 deletions Windows-Samples/Sensors/bios_secure_boot.ps1
@@ -0,0 +1,6 @@
# Returns True/False if Secure Boot is Enabled or Disabled
# Return Type: Boolean
# Execution Context: Admin
$bios = Confirm-SecureBootUEFI
echo $bios

5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/bios_serial_number.ps1
@@ -0,0 +1,5 @@
# Returns the device's serial number
# Return Type: String
# Execution Context: User
$os=Get-WmiObject Win32_bios -ComputerName $env:$computername -ea silentlycontinue
echo $os.SerialNumber
5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/bios_smbios_present.ps1
@@ -0,0 +1,5 @@
# Returns True/False whether the SMBIOS is Present
# Return Type: Boolean
# Execution Context: User
$bios=Get-WmiObject Win32_bios -ComputerName $env:computername -ea silentlycontinue
echo $bios.SMBIOSPresent
5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/bios_smbios_version.ps1
@@ -0,0 +1,5 @@
# Returns the SMBIOS Version
# Return Type: String
# Execution Context: User
$bios=Get-WmiObject Win32_bios -ComputerName $env:computername -ea silentlycontinue
echo $bios.SMBIOSBIOSVersion
7 changes: 7 additions & 0 deletions Windows-Samples/Sensors/bios_status.ps1
@@ -0,0 +1,7 @@
# 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.
# Return Type: String
# Execution Context: User
$bios=Get-WmiObject Win32_bios -ComputerName $env:computername -ea silentlycontinue
echo $bios.Status

6 changes: 6 additions & 0 deletions Windows-Samples/Sensors/os_cpu_usage.ps1
@@ -0,0 +1,6 @@
# Returns load capacity of each processor, averaged to the last second.
# Return Type: Integer
# Execution Context: User
$cpu_usage=Get-WmiObject win32_processor | Select-Object -ExpandProperty LoadPercentage
echo $cpu_usage

7 changes: 7 additions & 0 deletions Windows-Samples/Sensors/os_cpu_usage_processname.ps1
@@ -0,0 +1,7 @@
# Returns the average amount of processor time that the process has used on all processors, in seconds.
# Return Type: Integer
# Execution Context: User
# change mcshield to your process name
$cpu_usage=get-process mcshield |measure-object -property CPU -Average |select-object -ExpandProperty Average
echo ([System.Math]::Round($cpu_usage))

5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/os_java_version.ps1
@@ -0,0 +1,5 @@
# Returns Java Version e.g. 8.0.1910.12
# Return Type: String
# Execution Context: User
$javaver=(Get-Command java | Select-Object -ExpandProperty Version).toString()
echo $javaver
7 changes: 7 additions & 0 deletions Windows-Samples/Sensors/os_memory_physical_usage.ps1
@@ -0,0 +1,7 @@
# Returns used phsyical memory in kilobytes
# Return Type: Integer
# Execution Context: User
$os = Get-WmiObject win32_OperatingSystem
$used_memory = $os.totalvisiblememorysize - $os.freephysicalmemory
echo $used_memory

8 changes: 8 additions & 0 deletions Windows-Samples/Sensors/os_memory_usage_processname.ps1
@@ -0,0 +1,8 @@
# Returns the average amount of non-paged and paged memory that the process is using, in kilobytes.
# Return Type: Integer
# Execution Context: User
# change mcshield to your process name
$PM = get-process mcshield |Measure-object -property PM -Average|Select-Object -ExpandProperty Average
$NPM = get-process mcshield |Measure-object -property NPM -Average|Select-Object -ExpandProperty Average
echo [System.Math]::Round(($PM+$NPM)/1KB)

7 changes: 7 additions & 0 deletions Windows-Samples/Sensors/os_memory_virtual_usage.ps1
@@ -0,0 +1,7 @@
# Returns used virutal memory in kilobytes
# Return Type: Integer
# Execution Context: User
$os=Get-WmiObject win32_OperatingSystem
$used_memory=$os.totalvirtualmemorysize - $os.freevirtualmemory
echo $used_memory

7 changes: 7 additions & 0 deletions Windows-Samples/Sensors/os_network_interface_name.ps1
@@ -0,0 +1,7 @@
# Returns the name (description) of the active network interface
# Return Type: String
# Execution Context: User
$properties = @(Name,InterfaceDescription)
$physical_adapter = get-netadapter -physical | where status -eq "up" |select-object -Property $properties
echo $physical_adapter.InterfaceDescription

6 changes: 6 additions & 0 deletions Windows-Samples/Sensors/os_network_usage.ps1
@@ -0,0 +1,6 @@
# Returns used network in bytes
# Return Type: Integer
# Execution Context: User
$Total_bytes=Get-WmiObject -class Win32_PerfFormattedData_Tcpip_NetworkInterface |Measure-Object -property BytesTotalPersec -Average |Select-Object -ExpandProperty Average
echo ([System.Math]::Round($Total_bytes))

6 changes: 6 additions & 0 deletions Windows-Samples/Sensors/os_network_wifi_present.ps1
@@ -0,0 +1,6 @@
# Returns True/False if Wifi is present or not
# Return Type: Boolean
# Execution Context: User
$wireless = Get-WmiObject -class Win32_NetworkAdapter -filter "netconnectionid like 'Wi-Fi%'"
if($wireless){echo $true}
else {echo $false}
5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/os_power_plan_description.ps1
@@ -0,0 +1,5 @@
# Returns the description of the Power Plan
# Return Type: String
# Execution Context: Admin
$powerplan=get-wmiobject -namespace "root\cimv2\power" -class Win32_powerplan | where {$_.IsActive}
echo $powerplan.Description
5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/os_power_plan_name.ps1
@@ -0,0 +1,5 @@
# Returns the name of the Power Plan
# Return Type: String
# Execution Context: Admin
$powerplan=get-wmiobject -namespace "root\cimv2\power" -class Win32_powerplan | where {$_.IsActive}
echo $powerplan.ElementName
6 changes: 6 additions & 0 deletions Windows-Samples/Sensors/os_powershell_version.ps1
@@ -0,0 +1,6 @@
# Returns the PowerShell Version in Major.Minor.Build.Revision format
# Return Type: String
# Execution Context: User
$ps = $PSVersionTable.PSVersion
echo "$($ps.Major).$($ps.Minor).$($ps.Build).$($ps.Revision)"

11 changes: 11 additions & 0 deletions Windows-Samples/Sensors/os_process_running.ps1
@@ -0,0 +1,11 @@
# Returns True/False if Process is Running or Not.
# Return Type: Boolean
# Execution Context: User
# change mcshield to your process name
$process = Get-Process mcshield -ea SilentlyContinue
if($process){
echo $true
}else{
echo $false
}

5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/system_date.ps1
@@ -0,0 +1,5 @@
# Returns the system's date and time
# Return Type: Date/Time
# Execution Context: User
$date_current = get-Date -DisplayHint Date
echo $date_current
5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/tpm_locked_out.ps1
@@ -0,0 +1,5 @@
# Returns True/False whether the TPM is locked out
# Return Type: Boolean
# Execution Context: Admin
$tpm=get-tpm
echo $tpm.LockedOut
5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/tpm_lockout_heal_time.ps1
@@ -0,0 +1,5 @@
# Returns time (string) for how long the TPM will be locked out, if it locks
# Return Type: String
# Execution Context: Admin
$tpm=get-tpm
echo $tpm.LockoutHealTime
5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/tpm_present.ps1
@@ -0,0 +1,5 @@
# Returns True/False whether there is a TPM on the current computer
# Return Type: Boolean
# Execution Context: Admin
$tpm=get-tpm
echo $tpm.TpmPresent
5 changes: 5 additions & 0 deletions Windows-Samples/Sensors/tpm_ready.ps1
@@ -0,0 +1,5 @@
# Returns True/False whether TPM is Ready to be used
# Return Type: Boolean
# Execution Context: Admin
$tpm=get-tpm
echo $tpm.TpmReady

0 comments on commit 3315a82

Please sign in to comment.