.SYNOPSIS This Poweshell script make a REST API call to an AirWatch server. This particular script is used to pull device information based on serial numbers pulled from a file. If you need to build your own script, concentrate on the Get-BasicUserForAuth function. This creates the Base64 authentication string. Also look at the Build-Headers function as this is a requirement for the REST call.
.DESCRIPTION To understand the underlying call check https:// /API/v1/mdm/devices/help/resources/GetDevicesByBulkSerialNumber.
. EXAMPLE Execute-AWRestAPI.ps1 -userName Administrator -password password -tenantAPIKey 4+apikeyw/krandomSstuffIleq4MY6A7WPmo9K9AbM6A= -outputFile c:\Users\Administrator\Desktop\output.txt -endpointURL https://demo.awmdm.com/API/v1/mdm/devices/serialnumber -inputFile C:\Users\Administrator\Desktop\SerialNumbers1.txt -Verbose
. PARAMETER userName An AirWatch account in the tenant is being queried. This user must have the API role at a minimum.
. PARAMETER password The password that is used by the user specified in the username parameter
. PARAMETER tenantAPIKey This is the REST API key that is generated in the AirWatch Console. You locate this key at All Settings -> Advanced -> API -> REST, 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
. PARAMETER endpointURL This will be the https:// /API/v1/mdm/devices/serialnumber. If you want to modify this script to get other data please contact the REST API help at https:// /API/help.
. PARAMETER inputFile This will be the complete path and filename to a file that list you device serial numbers. You will have one serial number per line with not fomatting. Just the serial number of the device(s) you want information for.
. PARAMETER outputFile (optional) This is not required. If you don't specify this parameter on the command line, the script will just show