PowerShell - Active DirectoryWhich PowerShell command correctly lists all Active Directory users who are currently enabled?AGet-ADUser -Filter {Enabled -eq true} | Select-Object NameBGet-ADUser -Filter Enabled = true | Select NameCGet-ADUser -Filter 'Enabled -eq $true' | Select-Object NameDGet-ADUser -Filter 'Enabled == true' | Select NameCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand Get-ADUser filter syntaxThe filter parameter requires a string with a valid PowerShell expression.Step 2: Correct syntax'Enabled -eq $true' is the correct syntax to filter enabled users.Step 3: Selecting the Name propertySelect-Object Name correctly extracts the Name property.Final Answer:Get-ADUser -Filter 'Enabled -eq $true' | Select-Object Name -> Option CQuick Check:Filter uses single quotes and -eq operator [OK]Quick Trick: Use single quotes and -eq for filters [OK]Common Mistakes:Using '=' instead of '-eq' in filterUsing double equals '==' which is invalid in filter stringIncorrectly using script block {} in filter parameter
Master "Active Directory" in PowerShell9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PowerShell Quizzes Active Directory - Get-ADUser - Quiz 11easy Automation Patterns - Desired State Configuration (DSC) basics - Quiz 4medium Cross-Platform PowerShell - Why cross-platform extends reach - Quiz 15hard Remote Management - Enter-PSSession - Quiz 3easy Remote Management - Why remote execution scales management - Quiz 15hard Remote Management - SSH-based remoting (PowerShell 7+) - Quiz 15hard Scripting Best Practices - Code signing - Quiz 14medium System Administration - Service management (Get/Start/Stop-Service) - Quiz 10hard System Administration - Registry operations - Quiz 14medium System Administration - Process management (Get/Stop-Process) - Quiz 5medium