Support Forum: Get Support for Patch My PC Products and Services

Microsoft Configuration Manager and Intune (Enterprises/Paid) => Support and General Questions (Enterprises Using ConfigMgr and Intune) => Topic started by: Patch2000 on April 24, 2024, 07:09:36 AM

Title: Docker Desktop complete installation
Post by: Patch2000 on April 24, 2024, 07:09:36 AM
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.
Title: Re: Docker Desktop complete installation
Post by: Dan Gough (Patch My PC) on April 25, 2024, 01:40:58 AM
There is a script in our community scripts repo that handles the user group:

https://github.com/PatchMyPCTeam/Community-Scripts/tree/567278ecbeac16dab77282a89dc5db5e20a55027/Install/Post-Install/Docker%20Users%20Local%20Group

As for WSL, perhaps try a pre-script to run "wsl --install"?

https://learn.microsoft.com/en-us/windows/wsl/install
Title: Re: Docker Desktop complete installation
Post by: CJohnson on August 22, 2024, 03:54:57 PM
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!