File tree 1 file changed +11
-2
lines changed
docset/winserver2022-ps/activedirectory
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.
79
79
### Example 1: Create a user with an imported certificate
80
80
81
81
``` 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
83
87
```
84
88
85
89
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
104
108
### Example 4: Create a user and set password
105
109
106
110
``` 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
108
117
```
109
118
110
119
This command creates a new user named ChewDavid and sets the account password.
You can’t perform that action at this time.
0 commit comments