Skip to content

Commit 3e03d58

Browse files
robdericksonmichaeltlombardi
authored andcommitted
Fix formatting for Disable-ADAccount.
1 parent 52a0a9a commit 3e03d58

File tree

1 file changed

+126
-81
lines changed

1 file changed

+126
-81
lines changed

docset/winserver2022-ps/activedirectory/Disable-ADAccount.md

Lines changed: 126 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -16,63 +16,79 @@ Disables an Active Directory account.
1616
## SYNTAX
1717

1818
```
19-
Disable-ADAccount [-WhatIf] [-Confirm] [-AuthType <ADAuthType>] [-Credential <PSCredential>]
20-
[-Identity] <ADAccount> [-Partition <String>] [-PassThru] [-Server <String>] [<CommonParameters>]
19+
Disable-ADAccount [-WhatIf] [-Confirm] [-AuthType <ADAuthType>]
20+
[-Credential <PSCredential>] [-Identity] <ADAccount> [-Partition <String>] [-PassThru]
21+
[-Server <String>] [<CommonParameters>]
2122
```
2223

2324
## DESCRIPTION
24-
The **Disable-ADAccount** cmdlet disables an Active Directory user, computer, or service account.
2525

26-
The *Identity* parameter specifies the Active Directory user, computer service account, or other service account that you want to disable.
27-
You can identify an account by its distinguished name, GUID, security identifier (SID), or Security Accounts Manager (SAM) account name.
28-
You can also set the *Identity* parameter to an object variable such as `$<localADAccountObject>`, or you can pass an account object through the pipeline to the *Identity* parameter.
29-
For example, you can use the **Get-ADUser** cmdlet to retrieve a user account object and then pass the object through the pipeline to the **Disable-ADAccount** cmdlet.
30-
Similarly, you can use **Get-ADComputer** and **Search-ADAccount** to retrieve account objects.
26+
The `Disable-ADAccount` cmdlet disables an Active Directory user, computer, or service account.
3127

32-
For Active Directory Lightweight Directory Services (AD LDS) environments, the *Partition* parameter must be specified except in the following two conditions:
28+
The **Identity** parameter specifies the Active Directory user, computer service account, or other
29+
service account that you want to disable. You can identify an account by its distinguished name,
30+
GUID, security identifier (SID), or Security Accounts Manager (SAM) account name. You can also set
31+
the **Identity** parameter to an object variable such as `$<localADAccountObject>`, or you can pass
32+
an account object through the pipeline to the **Identity** parameter. For example, you can use the
33+
`Get-ADUser` cmdlet to retrieve a user account object and then pass the object through the
34+
pipeline to the `Disable-ADAccount` cmdlet. Similarly, you can use `Get-ADComputer` and
35+
`Search-ADAccount` to retrieve account objects.
36+
37+
For Active Directory Lightweight Directory Services (AD LDS) environments, the **Partition**
38+
parameter must be specified except in the following two conditions:
3339

3440
- The cmdlet is run from an Active Directory provider drive.
3541
- A default naming context or partition is defined for the AD LDS environment.
36-
To specify a default naming context for an AD LDS environment, set the **msDS-defaultNamingContext** property of the Active Directory directory service agent (DSA) object (**nTDSDSA**) for the AD LDS instance.
42+
43+
To specify a default naming context for an AD LDS environment, set the **msDS-defaultNamingContext**
44+
property of the Active Directory directory service agent (DSA) object (**nTDSDSA**) for the AD LDS
45+
instance.
3746

3847
## EXAMPLES
3948

40-
### Example 1: Disable an account by identity
41-
```
42-
PS C:\> Disable-ADAccount -Identity PattiFul
49+
### EXAMPLE 1
50+
51+
```powershell
52+
Disable-ADAccount -Identity PattiFul
4353
```
4454

45-
This command disables the account with identity SAMAccountName PattiFul.
55+
This command disables the account with identity SAMAccountName `PattiFul`.
4656

47-
### Example 2: Disable an account by Distinguished Name
48-
```
49-
PS C:\> Disable-ADAccount -Identity "CN=Patti Fuller,OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM"
57+
### EXAMPLE 2
58+
59+
```powershell
60+
Disable-ADAccount -Identity 'CN=Patti Fuller,OU=Finance,OU=Users,DC=FABRIKAM,DC=COM'
5061
```
5162

52-
This command disables the account with DistinguishedName CN=Patti Fuller,OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM.
63+
This command disables the account with DistinguishedName
64+
`CN=Patti Fuller,OU=Finance,OU=Users,DC=FABRIKAM,DC=COM`.
5365

54-
### Example 3: Disable all accounts in an organizational unit using a filter
55-
```
56-
PS C:\> Get-ADUser -Filter 'Name -like "*"' -SearchBase "OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM" | Disable-ADAccount
66+
### EXAMPLE 3
67+
68+
```powershell
69+
Get-ADUser -Filter 'Name -like "*"' -SearchBase "OU=Finance,OU=Users,DC=FABRIKAM,DC=COM" |
70+
Disable-ADAccount
5771
```
5872

59-
This command disables all accounts in the organizational unit OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM.
73+
This command disables all accounts in the organizational unit
74+
`OU=Finance,OU=Users,DC=FABRIKAM,DC=COM`.
6075

6176
## PARAMETERS
6277

6378
### -AuthType
79+
6480
Specifies the authentication method to use.
6581
The acceptable values for this parameter are:
6682

67-
- Negotiate or 0
68-
- Basic or 1
83+
- `Negotiate` or `0`
84+
- `Basic` or `1`
6985

70-
The default authentication method is Negotiate.
86+
The default authentication method is `Negotiate`.
7187

72-
A Secure Sockets Layer (SSL) connection is required for the Basic authentication method.
88+
A Secure Sockets Layer (SSL) connection is required for the `Basic` authentication method.
7389

7490
```yaml
75-
Type: ADAuthType
91+
Type: Microsoft.ActiveDirectory.Management.ADAuthType
7692
Parameter Sets: (All)
7793
Aliases:
7894
Accepted values: Negotiate, Basic
@@ -85,10 +101,11 @@ Accept wildcard characters: False
85101
```
86102
87103
### -Confirm
104+
88105
Prompts you for confirmation before running the cmdlet.
89106
90107
```yaml
91-
Type: SwitchParameter
108+
Type: System.Management.Automation.SwitchParameter
92109
Parameter Sets: (All)
93110
Aliases: cf
94111

@@ -100,20 +117,24 @@ Accept wildcard characters: False
100117
```
101118
102119
### -Credential
103-
Specifies the user account credentials to use to perform this task.
104-
The default credentials are the credentials of the currently logged on user unless the cmdlet is run from an Active Directory module for Windows PowerShell provider drive.
105-
If the cmdlet is run from such a provider drive, the account associated with the drive is the default.
106120
107-
To specify this parameter, you can type a user name, such as User1 or Domain01\User01 or you can specify a **PSCredential** object.
108-
If you specify a user name for this parameter, the cmdlet prompts for a password.
121+
Specifies the user account credentials to use to perform this task. The default credentials are the
122+
credentials of the currently logged on user unless the cmdlet is run from an Active Directory module
123+
for Windows PowerShell provider drive. If the cmdlet is run from such a provider drive, the account
124+
associated with the drive is the default.
125+
126+
To specify this parameter, you can type a user name, such as `User1` or `Domain01\User01` or you can
127+
specify a **PSCredential** object. If you specify a user name for this parameter, the cmdlet prompts
128+
for a password.
109129

110-
You can also create a **PSCredential** object by using a script or by using the **Get-Credential** cmdlet.
111-
You can then set the *Credential* parameter to the **PSCredential** object.
130+
You can also create a **PSCredential** object by using a script or by using the `Get-Credential`
131+
cmdlet. You can then set the **Credential** parameter to the **PSCredential** object.
112132

113-
If the acting credentials do not have directory-level permission to perform the task, Active Directory module for Windows PowerShell returns a terminating error.
133+
If the acting credentials do not have directory-level permission to perform the task, Active
134+
Directory module for Windows PowerShell returns a terminating error.
114135

115136
```yaml
116-
Type: PSCredential
137+
Type: System.Management.Automation.PSCredential
117138
Parameter Sets: (All)
118139
Aliases:
119140
@@ -125,28 +146,30 @@ Accept wildcard characters: False
125146
```
126147

127148
### -Identity
128-
Specifies an Active Directory account object by providing one of the following property values.
129-
The identifier in parentheses is the Lightweight Directory Access Protocol (LDAP) display name for the attribute.
130-
The acceptable values for this parameter are:
149+
150+
Specifies an Active Directory account object by providing one of the following property values. The
151+
identifier in parentheses is the Lightweight Directory Access Protocol (LDAP) display name for the
152+
attribute. The acceptable values for this parameter are:
131153

132154
- A distinguished name
133-
- A GUID (objectGUID)
134-
- A Security Identifier (objectSid)
135-
- A SAM Account Name (SAMAccountName)
155+
- A GUID (**objectGUID**)
156+
- A Security Identifier (**objectSid**)
157+
- A SAM Account Name (**SAMAccountName**)
136158

137159
The cmdlet searches the default naming context or partition to find the object.
138160
If two or more objects are found, the cmdlet returns a non-terminating error.
139161

140-
This parameter can also get this object through the pipeline or you can set this parameter to an account object instance.
162+
This parameter can also get this object through the pipeline or you can set this parameter to an
163+
account object instance.
141164

142-
Derived types such as the following are also accepted:
165+
Derived types such as the following are also accepted:
143166

144167
- **Microsoft.ActiveDirectory.Management.ADServiceAccount**
145168
- **Microsoft.ActiveDirectory.Management.ADComputer**
146169
- **Microsoft.ActiveDirectory.Management.ADUser**
147170

148171
```yaml
149-
Type: ADAccount
172+
Type: Microsoft.ActiveDirectory.Management.ADAccount
150173
Parameter Sets: (All)
151174
Aliases:
152175
@@ -158,30 +181,40 @@ Accept wildcard characters: False
158181
```
159182

160183
### -Partition
161-
Specifies the distinguished name of an Active Directory partition.
162-
The distinguished name must be one of the naming contexts on the current directory server.
163-
The cmdlet searches this partition to find the object defined by the *Identity* parameter.
164-
165-
In many cases, a default value is used for the *Partition* parameter if no value is specified.
166-
The rules for determining the default value are given below.
167-
Note that rules listed first are evaluated first and once a default value can be determined, no further rules are evaluated.
168-
169-
In Active Directory Domain Services (AD DS) environments, a default value for *Partition* is set in the following cases:
170184

171-
- If the *Identity* parameter is set to a distinguished name, the default value of *Partition* is automatically generated from this distinguished name.
172-
- If running cmdlets from an Active Directory provider drive, the default value of *Partition* is automatically generated from the current path in the drive.
173-
- 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.
174-
175-
In Active Directory Lightweight Directory Services (AD LDS) environments, a default value for *Partition* is set in the following cases:
176-
177-
- If the *Identity* parameter is set to a distinguished name, the default value of *Partition* is automatically generated from this distinguished name.
178-
- If running cmdlets from an Active Directory provider drive, the default value of *Partition* is automatically generated from the current path in the drive.
179-
- If the target AD LDS instance has a default naming context, the default value of *Partition* is set to the default naming context.
180-
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.
181-
- If none of the previous cases apply, the *Partition* parameter will not take any default value.
185+
Specifies the distinguished name of an Active Directory partition. The distinguished name must be
186+
one of the naming contexts on the current directory server. The cmdlet searches this partition to
187+
find the object defined by the **Identity** parameter.
188+
189+
In many cases, a default value is used for the **Partition** parameter if no value is specified. The
190+
rules for determining the default value are given below. Note that rules listed first are evaluated
191+
first and once a default value can be determined, no further rules are evaluated.
192+
193+
In Active Directory Domain Services environments, a default value for **Partition** is set in the
194+
following cases:
195+
196+
- If the **Identity** parameter is set to a distinguished name, the default value of **Partition**
197+
is automatically generated from this distinguished name.
198+
- If running cmdlets from an Active Directory provider drive, the default value of **Partition** is
199+
automatically generated from the current path in the drive.
200+
- If none of the previous cases apply, the default value of **Partition** is set to the default
201+
partition or naming context of the target domain.
202+
203+
In Active Directory Lightweight Directory Services (AD LDS) environments, a default value for
204+
**Partition** is set in the following cases:
205+
206+
- If the **Identity** parameter is set to a distinguished name, the default value of **Partition**
207+
is automatically generated from this distinguished name.
208+
- If running cmdlets from an Active Directory provider drive, the default value of **Partition** is
209+
automatically generated from the current path in the drive.
210+
- If the target AD LDS instance has a default naming context, the default value of **Partition** is
211+
set to the default naming context. To specify a default naming context for an AD LDS environment,
212+
set the **msDS-defaultNamingContext** property of the Active Directory directory service agent
213+
(DSA) object (**nTDSDSA**) for the AD LDS instance.
214+
- If none of the previous cases apply, the **Partition** parameter will not take any default value.
182215

183216
```yaml
184-
Type: String
217+
Type: System.String
185218
Parameter Sets: (All)
186219
Aliases:
187220
@@ -193,11 +226,12 @@ Accept wildcard characters: False
193226
```
194227

195228
### -PassThru
229+
196230
Returns an object representing the item with which you are working.
197231
By default, this cmdlet does not generate any output.
198232

199233
```yaml
200-
Type: SwitchParameter
234+
Type: System.Management.Automation.SwitchParameter
201235
Parameter Sets: (All)
202236
Aliases:
203237
@@ -209,30 +243,35 @@ Accept wildcard characters: False
209243
```
210244

211245
### -Server
212-
Specifies the Active Directory Domain Services instance to connect to, by providing one of the following values for a corresponding domain name or directory server.
213-
The service may be any of the following: Active Directory Lightweight Domain Services, Active Directory Domain Services or Active Directory snapshot instance.
214246

215-
Specify the Active Directory Domain Services instance in one of the following ways:
247+
Specifies the Active Directory Domain Services instance to connect to, by providing one of the
248+
following values for a corresponding domain name or directory server. The service may be any of the
249+
following: Active Directory Lightweight Domain Services, Active Directory Domain Services or Active
250+
Directory snapshot instance.
251+
252+
Specify the Active Directory Domain Services instance in one of the following ways:
216253

217254
Domain name values:
218255

219256
- Fully qualified domain name
220257
- NetBIOS name
221258

222-
Directory server values:
259+
Directory server values:
223260

224261
- Fully qualified directory server name
225262
- NetBIOS name
226263
- Fully qualified directory server name and port
227264

228-
The default value for this parameter is determined by one of the following methods in the order that they are listed:
265+
The default value for this parameter is determined by one of the following methods in the order that
266+
they are listed:
229267

230268
- By using the **Server** value from objects passed through the pipeline
231-
- By using the server information associated with the Active Directory Domain Services Windows PowerShell provider drive, when the cmdlet runs in that drive
269+
- By using the server information associated with the Active Directory Domain Services Windows
270+
PowerShell provider drive, when the cmdlet runs in that drive
232271
- By using the domain of the computer running Windows PowerShell
233272

234273
```yaml
235-
Type: String
274+
Type: System.String
236275
Parameter Sets: (All)
237276
Aliases:
238277
@@ -244,11 +283,12 @@ Accept wildcard characters: False
244283
```
245284

246285
### -WhatIf
286+
247287
Shows what would happen if the cmdlet runs.
248288
The cmdlet is not run.
249289

250290
```yaml
251-
Type: SwitchParameter
291+
Type: System.Management.Automation.SwitchParameter
252292
Parameter Sets: (All)
253293
Aliases: wi
254294
@@ -260,12 +300,17 @@ Accept wildcard characters: False
260300
```
261301

262302
### CommonParameters
263-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
303+
304+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
305+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
306+
-WarningAction, and -WarningVariable. For more information, see
307+
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
264308

265309
## INPUTS
266310

267311
### Microsoft.ActiveDirectory.Management.ADAccount
268-
An account object is received by the *Identity* parameter.
312+
313+
An account object is received by the **Identity** parameter.
269314

270315
Derived types, such as the following are also accepted:
271316

@@ -278,8 +323,9 @@ Derived types, such as the following are also accepted:
278323
### None
279324

280325
## NOTES
281-
* This cmdlet does not work with an Active Directory snapshot.
282-
* This cmdlet does not work with a read-only domain controller.
326+
327+
- This cmdlet does not work with an Active Directory snapshot.
328+
- This cmdlet does not work with a read-only domain controller.
283329

284330
## RELATED LINKS
285331

@@ -300,4 +346,3 @@ Derived types, such as the following are also accepted:
300346
[Unlock-ADAccount](./Unlock-ADAccount.md)
301347

302348
[AD DS Administration Cmdlets in Windows PowerShell](./activedirectory.md)
303-

0 commit comments

Comments
 (0)