Powershell set atrributes for AD groups

Last updated: July 22, 2025 at 10:38

Use the -Instance property with set-aduser

The Instance parameter provides a way to update a group object by applying the changes made to a copy of the object. When you set the Instance parameter to a copy of an Active Directory group object that has been modified, the Set-ADGroup cmdlet makes the same changes to the original group object. To get a copy of the object to modify, use the Get-ADGroup cmdlet. The Identity parameter is not allowed when you use the Instance parameter. For more information about the Instance parameter, see the Instance parameter description.

The issue occurs when trying to use -replace with a null value. It fails. In those cases just set the values to an AD object and use the -instance parameter.


references: