Script to add "Last User" to the "Remote Desktop Users" group
I think powershell can help with this one.
Make a powershell script with the following (verifying for your environment):
#Read the most recent inventory
[xml]$inventory = Get-Content C:\ProgramData\Dell\KACE\inventory.xml
#Get the last user
$user = $inventory.MachineStruct.LAST_USER.InnerText
#Add user to group
net localgroup "Remote Desktop Users" /add $user
Add the powershell script as a dependency to an online shell script (running as local system). For the script text use:
powershell.exe -nologo -noninteractive -windowstyle hidden -executionpolicy bypass -noprofile -file DependencyNameHere.ps1
I tested the powershell script, but didn't test deploying it from the kbox (though the code to do so is from another powershell script I have) so please make sure you test it first.