• Welcome to Support Forum: Get Support for Patch My PC Products and Services.
 

Docker Desktop complete installation

Started by Patch2000, April 24, 2024, 07:09:36 AM

Previous topic - Next topic

Patch2000

Hi!

Is there a smooth way to include WSL2 and make sure that the user installing Docker Desktop becomes a member of the local Docker-Users group when installing Docker Desktop from software center?


I've tried adding a postscript that runs "wsl --update" but that does not seem to do the trick.

Dan Gough (Patch My PC)


CJohnson

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!