Skip to content

Instantly share code, notes, and snippets.

@iyre
Created March 1, 2020 20:31
Show Gist options
  • Save iyre/564a61ced11aefd018edba4c553025fe to your computer and use it in GitHub Desktop.
Save iyre/564a61ced11aefd018edba4c553025fe to your computer and use it in GitHub Desktop.
$target = read-host "Target"
$group = read-host "Group"
$user = read-host "User"
Invoke-Command -ComputerName $target -ScriptBlock {
net localgroup $(args[0]) $(args[1]) /add
#With PS5
#Add-LocalGroupMember -Group $(args[0]) -Member $(args[1])
} -ArgumentList $group,$user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment