0
0
PowerShellscripting~10 mins

New-ADUser and Set-ADUser in PowerShell - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new Active Directory user with the name 'John Doe'.

PowerShell
New-ADUser -Name [1] -AccountPassword (ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force) -Enabled $true
Drag options to blanks, or click blank then click option'
A'John Doe'
B"John Doe"
CJohnDoe
DJohn_Doe
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put the name in quotes.
Using single quotes which may work but double quotes are preferred here.
Using a username instead of the full name.
2fill in blank
medium

Complete the code to set the user's department to 'Sales' using Set-ADUser.

PowerShell
Set-ADUser -Identity "jdoe" -[1] "Sales"
Drag options to blanks, or click blank then click option'
A-Title
B-Description
C-Office
D-Department
Attempts:
3 left
💡 Hint
Common Mistakes
Using -Title or -Office instead of -Department.
Forgetting the dash before the parameter.
3fill in blank
hard

Fix the error in the code to enable the user account after creation.

PowerShell
New-ADUser -Name "Jane Smith" -AccountPassword (ConvertTo-SecureString "P@ss1234" -AsPlainText -Force) [1]
Drag options to blanks, or click blank then click option'
A-Enabled $true
B-Enable $true
C-EnableAccount $true
D-EnabledAccount $true
Attempts:
3 left
💡 Hint
Common Mistakes
Using -Enable instead of -Enabled.
Using non-existent parameters like -EnableAccount.
4fill in blank
hard

Fill both blanks to create a new user with a given username and set the email address.

PowerShell
New-ADUser -Name "[1]" -SamAccountName [2] -AccountPassword (ConvertTo-SecureString "Pass123!" -AsPlainText -Force) -Enabled $true
Set-ADUser -Identity [2] -EmailAddress "[1]@example.com"
Drag options to blanks, or click blank then click option'
A"Alice Johnson"
Bajohnson
C"ajohnson"
DAliceJohnson
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the username.
Using the full name as the username.
Mixing up the parameters.
5fill in blank
hard

Fill all three blanks to create a user, enable the account, and set the office location.

PowerShell
New-ADUser -Name [1] -SamAccountName [2] -AccountPassword (ConvertTo-SecureString "Secret123" -AsPlainText -Force) [3]
Set-ADUser -Identity [2] -Office "HQ"
Drag options to blanks, or click blank then click option'
A"Bob Martin"
B"bmartin"
C-Enabled $true
D-Enable $true
Attempts:
3 left
💡 Hint
Common Mistakes
Using -Enable instead of -Enabled.
Not quoting the name or username.
Forgetting to enable the account.