Skip to content

Commit 45dbfe3

Browse files
committed
splats
1 parent 05823ef commit 45dbfe3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

docset/winserver2022-ps/activedirectory/New-ADUser.md

+11-2
Original file line numberDiff line numberDiff 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

8589
This 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

110119
This command creates a new user named ChewDavid and sets the account password.

0 commit comments

Comments
 (0)