Check-in [aaf317d39d]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add users to multiple groups, or query existing membership of users. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
aaf317d39d6dd7c0813b57b166c0cc04 |
| User & Date: | mario 2018-05-16 18:13:03 |
Context
|
2018-05-16
| ||
| 18:13 | Query permission groups for folders (Get-ACL) check-in: 08100351ec user: mario tags: trunk | |
| 18:13 | Add users to multiple groups, or query existing membership of users. check-in: aaf317d39d user: mario tags: trunk | |
| 18:11 | Template tool to craft/prepare new user scripts. check-in: 48e6e20fbb user: mario tags: trunk | |
Changes
Added tools/bulk/AddGroups.ps1.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# api: multitool
# version: 0.2
# title: Add users to groups
# description: Add-ADGroupMember
# type: inline
# category: bulk
# icon: user
# param: username, bulk
# vars:
# { name: usernames, type: text, value="$username", description: User/users to add to groups }
# { name: groups, type: text, value="PERM_Test1; PERM_StoreThings", description: "list of permission groups, can be delimited by comma/semicolon/spaces" }
# hidden: 0
# status: beta
# config: -
#
# Add user(s) to list of groups
#
# ❏ `username` from standard field
# ❏ comma-separated list of AD groups in `groups` field
#
Param(
$usernames = (Read-Host "Usernames"),
$groups = (Read-Host "groups")
);
$usernames = $usernames -split "[;,\s]+" | ? { $_ -match "\w+" } | % { $_ -replace "^\w+\\","" } | ? { Get-ADUser $_ }
$groups = $groups -split "[;,\s]+" | ? { $_ -match "\w+" }
ForEach ($group in $groups) {
Write-Host "❏ Add-ADGroupMember -Identity $group -Members $($usernames -join ',')"
$r = Add-ADGroupMember -Identity $group -Members $usernames
if ($r) {
Write-Host -f Green "✔ added"
}
else {
Write-Host -f Red "✘ (already had?)"
}
}
|
Added tools/bulk/GetGroups.ps1.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# api: multitool
# version: 0.1
# title: Get groups of user
# description: extract .MemberOf list
# type: inline
# category: bulk
# icon: user
# vars:
# { name: usernames, type: text, value="$username", description: User/users to compile membership list from }
# hidden: 0
# status: beta
# config: -
#
# Get group membership for list of users
#
# ❏ `username` from standard field
# ❏ comma-separated list of AD groups in `groups` field
#
Param(
$usernames = (Read-Host "Usernames")
);
$usernames = $usernames -split "[;,\s]+" | ? { $_ -match "\w+" } | % { $_ -replace "\w+\\","" } | ? { Get-ADUser $_ }
$groups = $usernames | % { (Get-ADUser $_ -Prop MemberOf).MemberOf }
$groups = $groups -notmatch "Allowed RODC Password Replication Group"
$groups = $groups | % { "$_" -replace "^CN=|,OU=.+$","" } | Sort -Unique | % { "$_;" }
$groups | FL | Out-String | Write-Host
|