Skip to content

Commit abdea35

Browse files
Apply suggestions from code review
Co-authored-by: Mikey Lombardi (He/Him) <[email protected]>
1 parent 9295375 commit abdea35

File tree

1 file changed

+71
-77
lines changed

1 file changed

+71
-77
lines changed

docset/winserver2022-ps/activedirectory/Get-ADComputer.md

Lines changed: 71 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,26 @@ Get-ADComputer [-AuthType <ADAuthType>] [-Credential <PSCredential>] -LDAPFilter
4444

4545
## DESCRIPTION
4646

47-
The **Get-ADComputer** cmdlet gets a computer or performs a search to retrieve multiple computers.
47+
The `Get-ADComputer` cmdlet gets a computer or performs a search to retrieve multiple computers.
4848

49-
The _Identity_ parameter specifies the Active Directory computer to retrieve.
49+
The **Identity** parameter specifies the Active Directory computer to retrieve.
5050
You can identify a computer by its distinguished name, GUID, security identifier
5151
(SID) or Security Accounts Manager (SAM) account name. You can also set the
5252
parameter to a computer object variable, such as `$<localComputerobject>` or
53-
pass a computer object through the pipeline to the _Identity_ parameter.
53+
pass a computer object through the pipeline to the **Identity** parameter.
5454

55-
To search for and retrieve more than one computer, use the _Filter_ or
56-
_LDAPFilter_ parameters. The _Filter_ parameter uses the PowerShell Expression
57-
Language to write query strings for Active Directory. PowerShell Expression
58-
Language syntax provides rich type conversion support for value types received
59-
by the _Filter_ parameter. For more information about the _Filter_ parameter
55+
To search for and retrieve more than one computer, use the **Filter** or **LDAPFilter** parameters.
56+
The **Filter** parameter uses the PowerShell Expression Language to write query strings for Active
57+
Directory. PowerShell Expression Language syntax provides rich type conversion support for value
58+
types received by the **Filter** parameter. For more information about the **Filter** parameter
6059
syntax, type `Get-Help`
61-
[about_ActiveDirectory_Filter](/previous-versions/windows/server/hh531527(v=ws.10)).
62-
If you have existing Lightweight Directory Access Protocol (LDAP) query strings,
63-
you can use the _LDAPFilter_ parameter.
60+
[about_ActiveDirectory_Filter](/previous-versions/windows/server/hh531527(v=ws.10)). If you have
61+
existing Lightweight Directory Access Protocol (LDAP) query strings, you can use the **LDAPFilter**
62+
parameter.
6463

65-
This cmdlet retrieves a default set of computer object properties. To retrieve
66-
additional properties use the _Properties_ parameter. For more information about
67-
the how to determine the properties for computer objects, see the _Properties_
68-
parameter description.
64+
This cmdlet retrieves a default set of computer object properties. To retrieve additional
65+
properties use the **Properties** parameter. For more information about the how to determine the
66+
properties for computer objects, see the **Properties** parameter description.
6967

7068
## EXAMPLES
7169

@@ -162,7 +160,7 @@ This command gets a specific computer showing all the properties.
162160

163161
```powershell
164162
Get-ADComputer -Filter 'Name -like "User01*"' -Properties IPv4Address |
165-
Format-Table Name,DNSHostName,IPv4Address -AutoSize
163+
Format-Table Name, DNSHostName, IPv4Address -AutoSize
166164
```
167165

168166
```Output
@@ -173,14 +171,14 @@ User01-SRV2 User01-SRV2.User01.com 10.194.100.3
173171
```
174172

175173
This command gets all the computers with a name starting with a particular
176-
string and shows the name, dns hostname, and IPv4 address.
174+
string and shows the name, DNS hostname, and IPv4 address.
177175

178176
### Example 3: Gets all computers that have changed their password in specific time frame
179177

180178
```powershell
181179
$Date = [DateTime]::Today.AddDays(-90)
182180
Get-ADComputer -Filter 'PasswordLastSet -ge $Date' -Properties PasswordLastSet |
183-
Format-Table Name,PasswordLastSet
181+
Format-Table Name, PasswordLastSet
184182
```
185183

186184
```Output
@@ -206,8 +204,8 @@ davidche-laptop
206204
```
207205

208206
This command gets the computer accounts in the location
209-
CN=Computers,DC=User01,DC=com that are listed as laptops by using an
210-
_LDAPFilter_.
207+
`CN=Computers,DC=User01,DC=com` that are listed as laptops by using an
208+
**LDAPFilter**.
211209

212210
### Example 5: Get all computer accounts using a filter
213211

@@ -221,7 +219,7 @@ This command gets all computer accounts.
221219

222220
```powershell
223221
Get-ADComputer -Filter 'Name -like "Computer01*" -or Name -like "Computer02*"' -Properties IPv4Address |
224-
Format-Table Name,DNSHostName,IPv4Address -AutoSize
222+
Format-Table Name, DNSHostName, IPv4Address -AutoSize
225223
```
226224

227225
```Output
@@ -236,7 +234,7 @@ Computer02-SRV2 Computer02-SRV2.Computer02.com 10.194.100.3
236234
```powershell
237235
$Date = [DateTime]::Today.AddDays(-30)
238236
Get-ADComputer -Filter 'Name -like "Computer01*" -and PasswordLastSet -ge $Date' -Properties IPv4Address |
239-
Format-Table Name,DNSHostName,IPv4Address -AutoSize
237+
Format-Table Name, DNSHostName, IPv4Address -AutoSize
240238
```
241239

242240
```Output
@@ -282,17 +280,16 @@ cmdlet is run from an Active Directory module for Windows PowerShell provider
282280
drive. If the cmdlet is run from such a provider drive, the account associated
283281
with the drive is the default.
284282
285-
To specify this parameter, you can type a user name, such as User1 or
286-
Domain01\User01 or you can specify a **PSCredential** object. If you specify a
287-
user name for this parameter, the cmdlet prompts for a password.
283+
To specify this parameter, you can type a user name, such as `User1` or `Domain01\User01` or you
284+
can specify a **PSCredential** object. If you specify a user name for this parameter, the cmdlet
285+
prompts for a password.
288286

289287
You can also create a **PSCredential** object by using a script or by using the
290-
**Get-Credential** cmdlet. You can then set the _Credential_ parameter to the
288+
`Get-Credential` cmdlet. You can then set the **Credential** parameter to the
291289
**PSCredential** object.
292290

293-
If the acting credentials do not have directory-level permission to perform the
294-
task, Active Directory module for Windows PowerShell returns a terminating
295-
error.
291+
If the acting credentials do not have directory-level permission to perform the task, the cmdlet
292+
returns a terminating error.
296293

297294
```yaml
298295
Type: PSCredential
@@ -310,11 +307,10 @@ Accept wildcard characters: False
310307

311308
Specifies a query string that retrieves Active Directory objects. This string
312309
uses the Windows PowerShell Expression Language syntax. The Windows PowerShell
313-
Expression Language syntax provides rich type-conversion support for value types
314-
received by the _Filter_ parameter. The syntax uses an in-order representation,
315-
which means that the operator is placed between the operand and the value. For
316-
more information about the _Filter_ parameter, type `Get-Help`
317-
[about_ActiveDirectory_Filter](/previous-versions/windows/server/hh531527(v=ws.10)).
310+
Expression Language syntax provides rich type-conversion support for value types received by the
311+
**Filter** parameter. The syntax uses an in-order representation, which means that the operator is
312+
placed between the operand and the value. For more information about the **Filter** parameter, type
313+
`Get-Help` [about_ActiveDirectory_Filter](/previous-versions/windows/server/hh531527(v=ws.10)).
318314

319315
Syntax:
320316

@@ -339,10 +335,11 @@ PowerShell Expression Language for this parameter.
339335

340336
For a list of supported types for \<value\>, type `Get-Help about_ActiveDirectory_ObjectModel`.
341337

342-
Note: Windows PowerShell wildcards other than \*, such as ?, are not supported
343-
by the _Filter_ syntax.
338+
> [!NOTE]
339+
> Wildcards other than `*`, such as `?`, are not supported by the **Filter** syntax.
344340

345-
Note: To query using LDAP query strings, use the _LDAPFilter_ parameter.
341+
> [!NOTE]
342+
> To query using LDAP query strings, use the **LDAPFilter** parameter.
346343

347344
```yaml
348345
Type: String
@@ -363,9 +360,9 @@ The identifier in parentheses is the LDAP display name for the attribute.
363360
The acceptable values for this parameter are:
364361

365362
- A distinguished name
366-
- A GUID (objectGUID)
367-
- A security identifier (objectSid)
368-
- A Security Accounts Manager account name (sAMAccountName)
363+
- A GUID (`objectGUID`)
364+
- A security identifier (`objectSid`)
365+
- A Security Accounts Manager account name (`sAMAccountName`)
369366

370367
The cmdlet searches the default naming context or partition to find the object.
371368
If the identifier given is a distinguished name, the partition to search is
@@ -390,9 +387,9 @@ Accept wildcard characters: False
390387
### -LDAPFilter
391388

392389
Specifies an LDAP query string that is used to filter Active Directory objects.
393-
You can use this parameter to run your existing LDAP queries. The _Filter_
390+
You can use this parameter to run your existing LDAP queries. The **Filter**
394391
parameter syntax supports the same functionality as the LDAP syntax. For more
395-
information, see the _Filter_ parameter description or type `Get-Help`
392+
information, see the **Filter** parameter description or type `Get-Help`
396393
[about_ActiveDirectory_Filter](/previous-versions/windows/server/hh531527(v=ws.10)).
397394

398395
```yaml
@@ -411,36 +408,35 @@ Accept wildcard characters: False
411408

412409
Specifies the distinguished name of an Active Directory partition.
413410
The distinguished name must be one of the naming contexts on the current directory server.
414-
The cmdlet searches this partition to find the object defined by the _Identity_ parameter.
411+
The cmdlet searches this partition to find the object defined by the **Identity** parameter.
415412

416-
In many cases, a default value is used for the _Partition_ parameter if no value
413+
In many cases, a default value is used for the **Partition** parameter if no value
417414
is specified. The rules for determining the default value are given below. Note
418415
that rules listed first are evaluated first and once a default value can be
419416
determined, no further rules are evaluated.
420417

421418
In Active Directory Domain Services environments, a default value for
422-
_Partition_ is set in the following cases:
419+
**Partition** is set in the following cases:
423420

424-
- If the _Identity_ parameter is set to a distinguished name, the default value
425-
of _Partition_ is automatically generated from this distinguished name.
426-
- If running cmdlets from an Active Directory provider drive, the default value
427-
of _Partition_ is automatically generated from the current path in the drive.
428-
- If none of the previous cases apply, the default value of _Partition_ is set
429-
to the default partition or naming context of the target domain.
421+
- If the **Identity** parameter is set to a distinguished name, the default value of **Partition**
422+
is automatically generated from this distinguished name.
423+
- If running cmdlets from an Active Directory provider drive, the default value of **Partition** is
424+
automatically generated from the current path in the drive.
425+
- If none of the previous cases apply, the default value of **Partition** is set to the default
426+
partition or naming context of the target domain.
430427

431428
In Active Directory Lightweight Directory Services (AD LDS) environments, a
432-
default value for _Partition_ is set in the following cases:
433-
434-
- If the _Identity_ parameter is set to a distinguished name, the default value
435-
of _Partition_ is automatically generated from this distinguished name.
436-
- If running cmdlets from an Active Directory provider drive, the default value
437-
of _Partition_ is automatically generated from the current path in the drive.
438-
- If the target AD LDS instance has a default naming context, the default value
439-
of _Partition_ is set to the default naming context. To specify a default
440-
naming context for an AD LDS environment, set the
441-
**msDS-defaultNamingContext** property of the Active Directory directory
442-
service agent (DSA) object (**nTDSDSA**) for the AD LDS instance.
443-
- If none of the previous cases apply, the _Partition_ parameter will not take any default value.
429+
default value for **Partition** is set in the following cases:
430+
431+
- If the **Identity** parameter is set to a distinguished name, the default value of **Partition**
432+
is automatically generated from this distinguished name.
433+
- If running cmdlets from an Active Directory provider drive, the default value of **Partition** is
434+
automatically generated from the current path in the drive.
435+
- If the target AD LDS instance has a default naming context, the default value of **Partition** is
436+
set to the default naming context. To specify a default naming context for an AD LDS environment,
437+
set the **msDS-defaultNamingContext** property of the Active Directory directory service agent
438+
(DSA) object (**nTDSDSA**) for the AD LDS instance.
439+
- If none of the previous cases apply, the **Partition** parameter will not take any default value.
444440

445441
```yaml
446442
Type: String
@@ -466,9 +462,8 @@ To specify an individual extended property, use the name of the property. For
466462
properties that are not default or extended properties, you must specify the
467463
LDAP display name of the attribute.
468464

469-
To retrieve properties and display them for an object, you can use the Get-*
470-
cmdlet associated with the object and pass the output to the **Get-Member**
471-
cmdlet.
465+
To retrieve properties and display them for an object, you can use the `Get-*` cmdlet associated
466+
with the object and pass the output to the `Get-Member` cmdlet.
472467

473468
```yaml
474469
Type: String[]
@@ -540,10 +535,9 @@ agent object (**nTDSDSA**) for the AD LDS instance. If no default naming context
540535
has been specified for the target AD LDS instance, then this parameter has no
541536
default value.
542537

543-
When the value of the _SearchBase_ parameter is set to an empty string and you
544-
are connected to a global catalog port, all partitions are searched. If the
545-
value of the _SearchBase_ parameter is set to an empty string and you are not
546-
connected to a global catalog port, an error is thrown.
538+
When the value of the **SearchBase** parameter is set to an empty string and you are connected to a
539+
global catalog port, all partitions are searched. If the value of the **SearchBase** parameter is
540+
set to an empty string and you are not connected to a global catalog port, an error is thrown.
547541

548542
```yaml
549543
Type: String
@@ -607,7 +601,7 @@ Directory server values:
607601
The default value for this parameter is determined by one of the following
608602
methods in the order that they are listed:
609603

610-
- By using the _Server_ value from objects passed through the pipeline
604+
- By using the **Server** value from objects passed through the pipeline
611605
- By using the server information associated with the Active Directory Domain
612606
Services Windows PowerShell provider drive, when the cmdlet runs in that drive
613607
- By using the domain of the computer running Windows PowerShell
@@ -636,7 +630,7 @@ For more information, see
636630

637631
### None or Microsoft.ActiveDirectory.Management.ADComputer
638632

639-
A computer object is received by the _Identity_ parameter.
633+
A computer object is received by the **Identity** parameter.
640634

641635
## OUTPUTS
642636

@@ -645,10 +639,10 @@ A computer object is received by the _Identity_ parameter.
645639
Returns one or more computer objects.
646640

647641
This Get-ADComputer cmdlet returns a default set of **ADComputer** property values.
648-
To retrieve additional **ADComputer** properties, use the _Properties_ parameter of this cmdlet.
642+
To retrieve additional **ADComputer** properties, use the **Properties** parameter of this cmdlet.
649643

650644
To view the properties for an **ADComputer** object, see the following examples.
651-
To run these examples, replace \<computer\> with a computer identifier such as
645+
To run these examples, replace `<computer>` with a computer identifier such as
652646
the SAM account name of your local computer.
653647

654648
To get a list of the default set of properties of an ADComputer object, use the following command:
@@ -661,9 +655,9 @@ To get a list of all the properties of an ADComputer object, use the following c
661655

662656
## NOTES
663657

664-
- This cmdlet does not work with AD LDS with its default schema. By default AD
665-
LDS schema does not have a computer class, but if the schema is extended to
666-
include it, this cmdlet will work with LDS.
658+
- This cmdlet doesn't work with AD LDS with its default schema. By default the AD LDS schema
659+
doesn't have a computer class, but if the schema is extended to include it, this cmdlet will work
660+
with LDS.
667661

668662
## RELATED LINKS
669663

0 commit comments

Comments
 (0)