Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Josue Negron <jnegron@vmware.com>
- Loading branch information
1 parent
c6574ea
commit 3315a82
Showing
28 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
5 changes: 5 additions & 0 deletions
5
Windows-Samples/Sensors/battery_estimated_charge_remaining.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |