Skip to content

Commit 4be4559

Browse files
authored
Merge pull request MicrosoftDocs#2574 from velkovb/fix/2017-add-example
Resolves MicrosoftDocs#2017
2 parents f56f9f8 + 287b372 commit 4be4559

File tree

5 files changed

+161
-129
lines changed

5 files changed

+161
-129
lines changed

docset/winserver2012-ps/activedirectory/Get-ADUser.md

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ PS C:\> Get-ADUser -Identity ChewDavid -Properties *
8181
```Output
8282
Surname : David
8383
Name : Chew David
84-
UserPrincipalName :
84+
UserPrincipalName :
8585
GivenName : David
8686
Enabled : False
8787
SamAccountName : ChewDavid
@@ -100,6 +100,13 @@ PS C:\> Get-ADUser -Filter "Name -eq 'ChewDavid'" -SearchBase "DC=AppNC" -Proper
100100

101101
This command gets the user with the name ChewDavid in the Active Directory Lightweight Directory Services (AD LDS) instance.
102102

103+
### Example 5: Get all enabled user accounts
104+
```powershell
105+
C:\PS> Get-ADUser -LDAPFilter '(!userAccountControl:1.2.840.113556.1.4.803:=2)'
106+
```
107+
108+
This command gets all enabled user accounts in Active Directory using an LDAP filter.
109+
103110
## PARAMETERS
104111

105112
### -AuthType
@@ -116,7 +123,7 @@ A Secure Sockets Layer (SSL) connection is required for the Basic authentication
116123
```yaml
117124
Type: ADAuthType
118125
Parameter Sets: (All)
119-
Aliases:
126+
Aliases:
120127
Accepted values: Negotiate, Basic
121128

122129
Required: False
@@ -142,7 +149,7 @@ If the acting credentials do not have directory-level permission to perform the
142149
```yaml
143150
Type: PSCredential
144151
Parameter Sets: (All)
145-
Aliases:
152+
Aliases:
146153

147154
Required: False
148155
Position: Named
@@ -190,7 +197,7 @@ Note: To query using LDAP query strings, use the *LDAPFilter* parameter.
190197
```yaml
191198
Type: String
192199
Parameter Sets: Filter
193-
Aliases:
200+
Aliases:
194201
195202
Required: True
196203
Position: Named
@@ -205,8 +212,8 @@ The identifier in parentheses is the LDAP display name for the attribute.
205212
The acceptable values for this parameter are:
206213

207214
- A distinguished name
208-
- A GUID (objectGUID)
209-
- A security identifier (objectSid)
215+
- A GUID (objectGUID)
216+
- A security identifier (objectSid)
210217
- A SAM account name (sAMAccountName)
211218

212219
The cmdlet searches the default naming context or partition to find the object.
@@ -217,7 +224,7 @@ This parameter can also get this object through the pipeline or you can set this
217224
```yaml
218225
Type: ADUser
219226
Parameter Sets: Identity
220-
Aliases:
227+
Aliases:
221228
222229
Required: True
223230
Position: 0
@@ -235,7 +242,7 @@ For more information, see the *Filter* parameter description or type `Get-Help a
235242
```yaml
236243
Type: String
237244
Parameter Sets: LdapFilter
238-
Aliases:
245+
Aliases:
239246
240247
Required: True
241248
Position: Named
@@ -251,26 +258,26 @@ The cmdlet searches this partition to find the object defined by the *Identity*
251258

252259
In many cases, a default value is used for the *Partition* parameter if no value is specified.
253260
The rules for determining the default value are given below.
254-
Note that rules listed first are evaluated first and when a default value can be determined, no further rules are evaluated.
261+
Note that rules listed first are evaluated first, and when a default value can be determined, no further rules are evaluated.
255262

256-
In AD DS environments, a default value for *Partition* are set in the following cases:
263+
In AD DS environments, a default value for *Partition* is set in the following cases:
257264

258265
- If the *Identity* parameter is set to a distinguished name, the default value of *Partition* is automatically generated from this distinguished name.
259-
- If running cmdlets from an Active Directory provider drive, the default value of *Partition* is automatically generated from the current path in the drive.
266+
- If running cmdlets from an Active Directory provider drive, the default value of *Partition* is automatically generated from the current path in the drive.
260267
- If none of the previous cases apply, the default value of *Partition* is set to the default partition or naming context of the target domain.
261268

262-
In AD LDS environments, a default value for *Partition* will be set in the following cases:
269+
In AD LDS environments, a default value for *Partition* is set in the following cases:
263270

264-
- If the *Identity* parameter is set to a distinguished name, the default value of *Partition* is automatically generated from this distinguished name.
265-
- If running cmdlets from an Active Directory provider drive, the default value of *Partition* is automatically generated from the current path in the drive.
271+
- If the *Identity* parameter is set to a distinguished name, the default value of *Partition* is automatically generated from this distinguished name.
272+
- If running cmdlets from an Active Directory provider drive, the default value of *Partition* is automatically generated from the current path in the drive.
266273
- If the target AD LDS instance has a default naming context, the default value of *Partition* is set to the default naming context.
267-
To specify a default naming context for an AD LDS environment, set the **msDS-defaultNamingContext** property of the Active Directory directory service agent object (**nTDSDSA**) for the AD LDS instance.
274+
To specify a default naming context for an AD LDS environment, set the **msDS-defaultNamingContext** property of the Active Directory directory service agent object (**nTDSDSA**) for the AD LDS instance.
268275
- If none of the previous cases apply, the *Partition* parameter does not take any default value.
269276

270277
```yaml
271278
Type: String
272279
Parameter Sets: Identity
273-
Aliases:
280+
Aliases:
274281
275282
Required: False
276283
Position: Named
@@ -311,7 +318,7 @@ The default is 256 objects per page.
311318
```yaml
312319
Type: Int32
313320
Parameter Sets: Filter, LdapFilter
314-
Aliases:
321+
Aliases:
315322
316323
Required: False
317324
Position: Named
@@ -330,7 +337,7 @@ The default is $Null.
330337
```yaml
331338
Type: Int32
332339
Parameter Sets: Filter, LdapFilter
333-
Aliases:
340+
Aliases:
334341
335342
Required: False
336343
Position: Named
@@ -349,13 +356,13 @@ When you run a cmdlet outside of an Active Directory provider drive against an A
349356
When you run a cmdlet outside of an Active Directory provider drive against an AD LDS target, the default value is the default naming context of the target LDS instance if one has been specified by setting the **msDS-defaultNamingContext** property of the Active Directory directory service agent (DSA) object (**nTDSDSA**) for the AD LDS instance.
350357
If no default naming context has been specified for the target AD LDS instance, then this parameter has no default value.
351358

352-
When the value of the *SearchBase* parameter is set to an empty string and you are connected to a GC port, all partitions will be searched.
353-
If the value of the *SearchBase* parameter is set to an empty string and you are not connected to a GC port, an error will be thrown.
359+
When the value of the *SearchBase* parameter is set to an empty string and you are connected to a GC port, all partitions are searched.
360+
If the value of the *SearchBase* parameter is set to an empty string and you are not connected to a GC port, an error is thrown.
354361

355362
```yaml
356363
Type: String
357364
Parameter Sets: Filter, LdapFilter
358-
Aliases:
365+
Aliases:
359366
360367
Required: False
361368
Position: Named
@@ -380,7 +387,7 @@ A Subtree query searches the current path or object and all children of that pat
380387
```yaml
381388
Type: ADSearchScope
382389
Parameter Sets: Filter, LdapFilter
383-
Aliases:
390+
Aliases:
384391
Accepted values: Base, OneLevel, Subtree
385392
386393
Required: False
@@ -407,14 +414,14 @@ Directory server values:
407414

408415
The default value for the *Server* parameter is determined by one of the following methods in the order that they are listed:
409416

410-
- By using *Server* value from objects passed through the pipeline.
411-
- By using the server information associated with the Active Directory PowerShell provider drive, when running under that drive.
417+
- By using *Server* value from objects passed through the pipeline.
418+
- By using the server information associated with the Active Directory PowerShell provider drive, when running under that drive.
412419
- By using the domain of the computer running PowerShell.
413420

414421
```yaml
415422
Type: String
416423
Parameter Sets: (All)
417-
Aliases:
424+
Aliases:
418425
419426
Required: False
420427
Position: Named

docset/winserver2012r2-ps/activedirectory/Get-ADUser.md

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ PS C:\> Get-ADUser -Identity ChewDavid -Properties *
8383
```Output
8484
Surname : David
8585
Name : Chew David
86-
UserPrincipalName :
86+
UserPrincipalName :
8787
GivenName : David
8888
Enabled : False
8989
SamAccountName : ChewDavid
@@ -100,7 +100,14 @@ This command gets all of the properties of the user with the SAM account name Ch
100100
PS C:\> Get-ADUser -Filter "Name -eq 'ChewDavid'" -SearchBase "DC=AppNC" -Properties "mail" -Server lds.Fabrikam.com:50000
101101
```
102102

103-
This command gets the user with the name ChewDavid in the Active Directory Lightweight Directory Services (AD LDS) instance.
103+
This command gets the user with the name ChewDavid in the Active Directory Lightweight Directory Services (AD LDS) instance.'
104+
105+
### Example 5: Get all enabled user accounts
106+
```powershell
107+
C:\PS> Get-ADUser -LDAPFilter '(!userAccountControl:1.2.840.113556.1.4.803:=2)'
108+
```
109+
110+
This command gets all enabled user accounts in Active Directory using an LDAP filter.
104111

105112
## PARAMETERS
106113

@@ -118,7 +125,7 @@ A Secure Sockets Layer (SSL) connection is required for the Basic authentication
118125
```yaml
119126
Type: ADAuthType
120127
Parameter Sets: (All)
121-
Aliases:
128+
Aliases:
122129
Accepted values: Negotiate, Basic
123130

124131
Required: False
@@ -144,7 +151,7 @@ If the acting credentials do not have directory-level permission to perform the
144151
```yaml
145152
Type: PSCredential
146153
Parameter Sets: (All)
147-
Aliases:
154+
Aliases:
148155

149156
Required: False
150157
Position: Named
@@ -192,7 +199,7 @@ Note: To query using LDAP query strings, use the *LDAPFilter* parameter.
192199
```yaml
193200
Type: String
194201
Parameter Sets: Filter
195-
Aliases:
202+
Aliases:
196203
197204
Required: True
198205
Position: Named
@@ -207,8 +214,8 @@ The identifier in parentheses is the LDAP display name for the attribute.
207214
The acceptable values for this parameter are:
208215

209216
- A distinguished name
210-
- A GUID (objectGUID)
211-
- A security identifier (objectSid)
217+
- A GUID (objectGUID)
218+
- A security identifier (objectSid)
212219
- A SAM account name (sAMAccountName)
213220

214221
The cmdlet searches the default naming context or partition to find the object.
@@ -219,7 +226,7 @@ This parameter can also get this object through the pipeline or you can set this
219226
```yaml
220227
Type: ADUser
221228
Parameter Sets: Identity
222-
Aliases:
229+
Aliases:
223230
224231
Required: True
225232
Position: 0
@@ -237,7 +244,7 @@ For more information, see the *Filter* parameter description or type `Get-Help a
237244
```yaml
238245
Type: String
239246
Parameter Sets: LdapFilter
240-
Aliases:
247+
Aliases:
241248
242249
Required: True
243250
Position: Named
@@ -253,26 +260,26 @@ The cmdlet searches this partition to find the object defined by the *Identity*
253260

254261
In many cases, a default value is used for the *Partition* parameter if no value is specified.
255262
The rules for determining the default value are given below.
256-
Note that rules listed first are evaluated first and when a default value can be determined, no further rules are evaluated.
263+
Note that rules listed first are evaluated first, and when a default value can be determined, no further rules are evaluated.
257264

258-
In AD DS environments, a default value for *Partition* is set in the following cases:
265+
In AD DS environments, a default value for *Partition* is set in the following cases:
259266

260267
- If the *Identity* parameter is set to a distinguished name, the default value of *Partition* is automatically generated from this distinguished name.
261-
- If running cmdlets from an Active Directory provider drive, the default value of *Partition* is automatically generated from the current path in the drive.
268+
- If running cmdlets from an Active Directory provider drive, the default value of *Partition* is automatically generated from the current path in the drive.
262269
- If none of the previous cases apply, the default value of *Partition* is set to the default partition or naming context of the target domain.
263270

264-
In AD LDS environments, a default value for *Partition* will be set in the following cases:
271+
In AD LDS environments, a default value for *Partition* is set in the following cases:
265272

266-
- If the *Identity* parameter is set to a distinguished name, the default value of *Partition* is automatically generated from this distinguished name.
267-
- If running cmdlets from an Active Directory provider drive, the default value of *Partition* is automatically generated from the current path in the drive.
273+
- If the *Identity* parameter is set to a distinguished name, the default value of *Partition* is automatically generated from this distinguished name.
274+
- If running cmdlets from an Active Directory provider drive, the default value of *Partition* is automatically generated from the current path in the drive.
268275
- If the target AD LDS instance has a default naming context, the default value of *Partition* is set to the default naming context.
269-
To specify a default naming context for an AD LDS environment, set the **msDS-defaultNamingContext** property of the Active Directory directory service agent object (**nTDSDSA**) for the AD LDS instance.
276+
To specify a default naming context for an AD LDS environment, set the **msDS-defaultNamingContext** property of the Active Directory directory service agent object (**nTDSDSA**) for the AD LDS instance.
270277
- If none of the previous cases apply, the *Partition* parameter does not take any default value.
271278

272279
```yaml
273280
Type: String
274281
Parameter Sets: Identity
275-
Aliases:
282+
Aliases:
276283
277284
Required: False
278285
Position: Named
@@ -313,7 +320,7 @@ The default is 256 objects per page.
313320
```yaml
314321
Type: Int32
315322
Parameter Sets: Filter, LdapFilter
316-
Aliases:
323+
Aliases:
317324
318325
Required: False
319326
Position: Named
@@ -332,7 +339,7 @@ The default is $Null.
332339
```yaml
333340
Type: Int32
334341
Parameter Sets: Filter, LdapFilter
335-
Aliases:
342+
Aliases:
336343
337344
Required: False
338345
Position: Named
@@ -351,13 +358,13 @@ When you run a cmdlet outside of an Active Directory provider drive against an A
351358
When you run a cmdlet outside of an Active Directory provider drive against an AD LDS target, the default value is the default naming context of the target LDS instance if one has been specified by setting the **msDS-defaultNamingContext** property of the Active Directory directory service agent (DSA) object (**nTDSDSA**) for the AD LDS instance.
352359
If no default naming context has been specified for the target AD LDS instance, then this parameter has no default value.
353360

354-
When the value of the *SearchBase* parameter is set to an empty string and you are connected to a GC port, all partitions will be searched.
355-
If the value of the *SearchBase* parameter is set to an empty string and you are not connected to a GC port, an error will be thrown.
361+
When the value of the *SearchBase* parameter is set to an empty string and you are connected to a GC port, all partitions are searched.
362+
If the value of the *SearchBase* parameter is set to an empty string and you are not connected to a GC port, an error is thrown.
356363

357364
```yaml
358365
Type: String
359366
Parameter Sets: Filter, LdapFilter
360-
Aliases:
367+
Aliases:
361368
362369
Required: False
363370
Position: Named
@@ -381,7 +388,7 @@ A Subtree query searches the current path or object and all children of that pat
381388
```yaml
382389
Type: ADSearchScope
383390
Parameter Sets: Filter, LdapFilter
384-
Aliases:
391+
Aliases:
385392
Accepted values: Base, OneLevel, Subtree
386393
387394
Required: False
@@ -408,14 +415,14 @@ Directory server values:
408415

409416
The default value for the *Server* parameter is determined by one of the following methods in the order that they are listed:
410417

411-
- By using *Server* value from objects passed through the pipeline.
412-
- By using the server information associated with the Active Directory PowerShell provider drive, when running under that drive.
418+
- By using *Server* value from objects passed through the pipeline.
419+
- By using the server information associated with the Active Directory PowerShell provider drive, when running under that drive.
413420
- By using the domain of the computer running PowerShell.
414421

415422
```yaml
416423
Type: String
417424
Parameter Sets: (All)
418-
Aliases:
425+
Aliases:
419426
420427
Required: False
421428
Position: Named

0 commit comments

Comments
 (0)