Windows - Local Auto Device Registration and Enrollment
This set of scripts will run locally on a device and use AirWatch's APIs to register itself using it's serial number then perform an auto enrollment using a staging account, but auto map to the correct user in AirWatch. You can use your existing deployment tool, bake into the image, or manually run on a device.
Does the "Bin" directory and the .dll files get created as part of the script, or is this suppose to be include along with the zipped contents?
PS C:\Installs\AirWatch> C:\Installs\AirWatch\register_device_ps.ps1
AirWatch Agent Exists
Name Value
---- -----
serialNumber VM0Vs9EE5qC0
username WIN10Device1\AdminTest
Exception calling "RegisterDeviceArg" with "1" argument(s): "The given key was not present in the dictionary."
At C:\Installs\AirWatch\register_device_ps.ps1:107 char:1
+ $isRegister = $Register.RegisterDeviceArg($regArgs);
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : KeyNotFoundException
Do not enroll device and email IT
In digging into the C# code in Registration.cs, I see where the dictionary keys are coming from the localdevice.ini file, but the code looks like it is attempting to if the devices serialname is already registered to the Username of the locally logged on user and if this returns false, it craps out. Am I reading this wrong or is there something else I'm over looking? I figured that the point of the script was to check if the device was already registered and if not register it and install the agent. Am I correct?