File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
docset/winserver2022-ps/activedirectory Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,11 @@ through the pipeline to the `New-ADUser` cmdlet to create the user objects.
7979### Example 1: Create a user with an imported certificate
8080
8181``` powershell
82- New-ADUser -Name "ChewDavid" -Certificate (New-Object System.Security.Cryptography.X509Certificates.X509Certificate -ArgumentList "Export.cer")
82+ $splat = @{
83+ Name = 'ChewDavid'
84+ Certificate = (New-Object System.Security.Cryptography.X509Certificates.X509Certificate -ArgumentList "Export.cer")
85+ }
86+ New-ADUser @splat
8387```
8488
8589This command creates a user named ChewDavid with a certificate imported from the file Export.cer.
@@ -104,7 +108,12 @@ This command creates an **inetOrgPerson**-class user named ChewDavid on an AD LD
104108### Example 4: Create a user and set password
105109
106110``` powershell
107- New-ADUser -Name "ChewDavid" -AccountPassword (Read-Host -AsSecureString "AccountPassword") -Enabled $true
111+ $splat = @{
112+ Name = "ChewDavid"
113+ AccountPassword = (Read-Host -AsSecureString "AccountPassword")
114+ Enabled = $true
115+ }
116+ New-ADUser @splat
108117```
109118
110119This command creates a new user named ChewDavid and sets the account password.
You can’t perform that action at this time.
0 commit comments