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

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,910 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,628 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 47,681 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. Daisy Zhou 30,891 Reputation points Microsoft External Staff
    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 Answers by the question author, which helps users to know the answer solved the author's problem.