For anyone using Windows Autopilot/Azure joined machines and Intune, I was able to get the installer to add users to "docker-users" by tweaking the above script that Dan linked to by swapping out the "Add-LocalGroupMember" cmdlet for "net localgroup".
The full script would look like this:
}
$local_group = "docker-users"
$local_group_members = Get-LocalGroupMember -name $local_group
# Getting current session user
$currentUser = get-wmiobject win32_process -Filter "name='explorer.exe'" |
ForEach-Object { $_.GetOwner() } | Select-Object -Unique -Expand User
# If user is not in 'docker-users' add current user
if (!($local_group_members -contains $currentUser)){
net localgroup $local_group /add "AzureAD\[email protected]"
}
else {
write-host "$currentUser already in group"
Exit
}
Just update the domain in that line to match yours and it should be good to go!
The full script would look like this:
}
$local_group = "docker-users"
$local_group_members = Get-LocalGroupMember -name $local_group
# Getting current session user
$currentUser = get-wmiobject win32_process -Filter "name='explorer.exe'" |
ForEach-Object { $_.GetOwner() } | Select-Object -Unique -Expand User
# If user is not in 'docker-users' add current user
if (!($local_group_members -contains $currentUser)){
net localgroup $local_group /add "AzureAD\[email protected]"
}
else {
write-host "$currentUser already in group"
Exit
}
Just update the domain in that line to match yours and it should be good to go!