You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The **Disable-ADAccount** cmdlet disables an Active Directory user, computer, or service account.
25
25
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.
31
27
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:
33
39
34
40
- The cmdlet is run from an Active Directory provider drive.
35
41
- 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.
37
46
38
47
## EXAMPLES
39
48
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
43
53
```
44
54
45
-
This command disables the account with identity SAMAccountName PattiFul.
55
+
This command disables the account with identity SAMAccountName `PattiFul`.
46
56
47
-
### Example 2: Disable an account by Distinguished Name
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.
106
120
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.
109
129
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.
112
132
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.
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:
170
184
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.
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.
214
246
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:
216
253
217
254
Domain name values:
218
255
219
256
- Fully qualified domain name
220
257
- NetBIOS name
221
258
222
-
Directory server values:
259
+
Directory server values:
223
260
224
261
- Fully qualified directory server name
225
262
- NetBIOS name
226
263
- Fully qualified directory server name and port
227
264
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:
229
267
230
268
- 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
232
271
- By using the domain of the computer running Windows PowerShell
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,
0 commit comments