Why are some Active Directory object attributes not writeable with PowerShell?

fubar 1 Reputation point
2021-03-04T20:42:04.247+00:00

Hello,

I want to use PowerShell to write to the flags attribute of a group object in my Active Directory.

But PowerShell with the ActiveDirectory module won't even retrieve this attribute.

Why is that?

Is there any PowerShell module that allows one to write any attribute in AD?

Thanks

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 48,026 Reputation points
    2021-03-04T20:53:57.387+00:00

    You can always fall back to using ADSI in PowerShell.

    Not showing the script (or at least the portion of the script) you're having a problem with is never a good idea.

    It may be that the object returned by PowerShell has decoded the flag bits into named properties of that object, but who can tell exactly what you're trying to do?

    0 comments No comments

  2. Anonymous
    2021-03-05T02:57:06.06+00:00

    Hello @fubar ,

    Thank you for posting here.

    Based on the descroption above, not sure what PS command you are using and what error message you are receiving.

    Here is PS command, I can add flags attribute value to one group (groups1 is the group name, I set the flags value as 2.).

    For example:

    Set the flags value:
    Get-ADGroup -Identity group1 -Properties * | Set-ADGroup -replace @{flags = 2}

    View the flags value:
    (Get-ADGroup -Identity group1 -Properties *)

    74587-flag.png

    Set-ADGroup
    https://learn.microsoft.com/en-us/powershell/module/addsadministration/set-adgroup?view=win10-ps

    hope the information above is helpful.

    Should you have any question or concern, please feel free to let us know.

    Best Regards,
    Daisy Zhou

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.