📌  相关文章
📜  每个 powershell 的活动目录用户 kopieren - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:49:54.355000             🧑  作者: Mango

代码示例1
[regex]$regex = "(?:,)(?'name'((CN|OU=).*))"

Get-ADUser -Filter * -SearchBase "OU=Benutzer,DC=ad2016,DC=faq-o-matic,DC=net" | ForEach-Object {
    $ou = $regex.Match($_.DistinguishedName).Groups['name']

    Write-Host($_.Name + ": $ou")
    $_ | Set-ADUser -Add @{info=$ou}
}