0
0
PowerShellscripting~20 mins

Group management in PowerShell - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Group Management Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this PowerShell command?
Consider the following command that lists all members of the group 'HRTeam'. What will be the output if the group has exactly two members: Alice and Bob?
PowerShell
Get-ADGroupMember -Identity HRTeam | Select-Object -ExpandProperty Name
A
Alice
Bob
B
Name
Alice
Bob
C
ObjectGUID
Name
SamAccountName
DError: The term 'Get-ADGroupMember' is not recognized
Attempts:
2 left
💡 Hint
The command lists members and selects only their names.
📝 Syntax
intermediate
2:00remaining
Which command correctly adds a user to a group?
You want to add the user 'jdoe' to the group 'FinanceTeam'. Which of the following commands will do this correctly?
AAdd-ADGroupMember FinanceTeam jdoe
BAdd-ADGroupMember -Group FinanceTeam -User jdoe
CAdd-ADGroupMember -Identity FinanceTeam -Members jdoe
DAdd-ADGroupMember -Identity jdoe -Members FinanceTeam
Attempts:
2 left
💡 Hint
Check the parameter names for the Add-ADGroupMember cmdlet.
🔧 Debug
advanced
2:00remaining
Why does this script fail to remove a user from a group?
This script is intended to remove user 'jdoe' from group 'SalesTeam', but it fails with an error. What is the cause? Remove-ADGroupMember -Identity SalesTeam -Members jdoe Error: "Cannot find an object with identity: 'jdoe'"
AThe Remove-ADGroupMember cmdlet requires the -Recursive switch.
BThe command requires the -Confirm parameter to proceed.
CThe user 'jdoe' must be specified with the full distinguished name or objectGUID.
DThe user 'jdoe' does not exist in Active Directory.
Attempts:
2 left
💡 Hint
The error says it cannot find the object 'jdoe'.
🚀 Application
advanced
2:00remaining
How to list all groups a user belongs to?
You want to find all groups that the user 'maria' is a member of. Which command will correctly list these groups?
AGet-ADUser -Identity maria -Properties MemberOf | Select-Object -ExpandProperty MemberOf
BGet-ADGroup -Filter {Members -eq 'maria'}
CGet-ADGroupMember -Identity maria
DGet-ADUser -Identity maria | Get-ADGroupMember
Attempts:
2 left
💡 Hint
User objects have a MemberOf property listing their groups.
🧠 Conceptual
expert
2:00remaining
What is the effect of the -Recursive switch in Get-ADGroupMember?
When using Get-ADGroupMember with the -Recursive switch, what is the expected behavior?
AIt lists only direct members of the group, ignoring nested groups.
BIt lists all members of the group including members of nested groups recursively.
CIt removes all members from the group recursively.
DIt adds members to the group recursively.
Attempts:
2 left
💡 Hint
Think about nested groups inside a group.