LocalGroupHelper

Adds principals (domain groups, domain users, local users) to a local Windows group. This is the non-GPO way to get a state like "osisa\LOCALADMINS is local admin on this node": moving the computer object into the right OU and waiting for policy works, but only once the OU and its GPO exist - this makes the same membership explicit and immediate, and survives a node that policy has not reached yet.

Note
Built-in group names are LOCALIZED (a German node has Administratoren, not Administrators), so a plain Add-LocalGroupMember -Group 'Administrators' fails on exactly the nodes in this lab. Every built-in is therefore resolved by its well-known SID first and only falls back to the literal name for custom groups such as docker-users.
public static class LocalGroupHelper

1. Methods

1.1. AddMember(ISystemHost, string, string)

Adds member to the local group groupName. Idempotent - a principal that is already a member is reported and treated as success.

public static bool AddMember(ISystemHost host, string groupName, string member)
Table 1. Parameters
Name Type Description

host

ISystemHost

Host to configure.

groupName

string

Local group, English built-in name or a custom group (e.g. "docker-users").

member

string

Principal to add, either DOMAIN\Principal or a plain local username.

Returns: bool — True when the principal is a member of the group afterwards.