Rasteril
Rasteril

Reputation: 615

How to create a group with a group ID in Windows?

I would like to do the Windows equivalent of these Linux commands:

sudo groupadd -r -g 82 alpine-www-data
sudo usermod -a -G alpine-www-data $(id -un)

What I'm personally trying to achieve is explained in this question:

https://serverfault.com/questions/842789/docker4wordpress-fixing-permission-problems-for-windows

Any help would be greatly appreciated.

Upvotes: 0

Views: 1055

Answers (1)

henrycarteruk
henrycarteruk

Reputation: 13227

PowerShell to create a alpine-www-data group and add the Administrator account to it:

$Computer = $env:COMPUTERNAME
$User = "Administrator"
$GroupName = "alpine-www-data"

$ADSI = [ADSI]("WinNT://$Computer")
$Group = $ADSI.Create("Group", $GroupName)
$Group.SetInfo()

$Group.Add(("WinNT://$computer/$user"))

And the CMD version of it:

net localgroup alpine-www-data /add
net localgroup alpine-www-data Administrator /add

Upvotes: 1

Related Questions