PowerShell Set-QADGroup

柔情痞子 提交于 2019-12-11 14:51:44

问题


I've gotten the following to work:

get-QADGroup -SearchRoot 'ex.local/' -LdapFilter '(samaccountname=test_group*)' -GroupType 'Distribution' -IncludedProperties "displayName", "mailNickname", "name", "mail" | foreach-object {
    Set-QADGroup $_ –displayName ("new_displayname")
}

I can't get the following properties to work :/

mail
mailNickname
name
cn
dn

The reason behind this is because we are going to be renaming every object in our AD (thousands of groups), and i need all properties to be changed.

been reading Quest everywhere however they only take up displayName as an example and nothing more advanced.


回答1:


You can set some values using parameters, such as Email and DisplayName. You can set properties that do not have have a corresponding parameter using the ObjectAttributes parameter. It takes a hash table where the key name is the LDAP property name.

Get-QADGroup -SearchRoot 'ex.local/' -SamAccountName test_group* -GroupType Distribution -IncludedProperties displayName,mailNickname,name,mail | Foreach-Object {
    Set-QADGroup $_  -DisplayName "new_displayname" -Email "newemail" -ObjectAttributes @{attrib1="new_attrib1"; attrib2="new_attrib2"}
}

To rename an object use the Rename-QADObject cmdlet



来源:https://stackoverflow.com/questions/11190468/powershell-set-qadgroup

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!