Blank Enabled field from Get-ADUser result

n03z 21 Reputation points
2023-07-03T08:51:28.7466667+00:00

I want to read the "Enabled" field of user account information using Powershell Get-ADUser.

Here is the command that I used:

Get-ADUser -SearchBase "OU=Marketing,OU=Users,OU=Apple,DC=Orange,DC=Grape,DC=uk" -Filter * -Properties Enabled | select-object SAMAccountName, Enabled

And I got this kind of results:

SAMAccountName Enabled

--------------------- ---------

User1 True

User2 True

User3

User4 False

User5 True

User6

User7 False

Why some of the users returned "blank" for the "Enabled" field? I searched from the same OU. I got True and False results from some users though.

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,532 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,598 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 47,496 Reputation points
    2023-07-03T15:09:15.91+00:00

    Run your script with elevated privileges. I.e., start Powershell with "Run as administrator".

    As a regular user you may not have the necessary permission to access the state of those users.


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.