PowerShell 技能连载 - 简单的 AD 组管理

假设您已下载安装了微软免费的 RSAT 工具,那么管理 AD 组合组成员会相当轻松。以下几行代码演示了如何入门:

#requires -Version 1 -Modules ActiveDirectory
# create new AD group
New-ADGroup -DisplayName PowerShellGurus -GroupScope DomainLocal -Name PSGurus

# get group
Get-ADGroup -Identity PSGurus -Credential $cred -Server 172.16.14.53


# select users by some criteria
$newMembers = Get-ADUser -Filter 'Name -like "User*"'

# add them to new AD group
Add-ADGroupMember -Identity 'PSGurus' -Members $newMembers

# list members of group
Get-ADGroupMember -Identity PSGurus

PowerShell 技能连载 - 简单的 AD 组管理

http://blog.vichamp.com/2015/07/13/simple-ad-group-management/

作者

吴波

发布于

2015-07-13

更新于

2022-07-06

许可协议

评论