M
M
malchikmolodoy2022-04-18 13:12:17
PowerShell
malchikmolodoy, 2022-04-18 13:12:17

Completely disable an Active Directory account?

Such a task is worth it.
You need to disable the account in Active Directory, then move it to a separate remote users folder. And the exchange mail needs to be removed from the list of addresses and moved to the remote database.
How can this be done through Powershell?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MaxKozlov, 2022-04-18
@malchikmolodoy

1. It has already been said above. in addition, I can also suggest Set-ADUser -Enabled: $false
2. It seems to me that you meant Exchange commands
. So you need
Set-Mailbox --HiddenFromAddressListsEnabled:$true
It is also an AD attribute msExchHideFromAddressLists
and
New-MoveRequest -TargetDatabase "DbForDisabledUsers"

M
Morrowind, 2022-04-18
@hekkaaa

Hey!
Here you will have 2 tasks in 1 script:
1 - Use this Disable-ADAccount cmdlet
2 - I did not fully understand the task of moving. But probably you just want to disable some kind of mail. You need the Disable-Mailbox cmdlet . There are also Get and Set implementations, if something needs to be looked at or changed beforehand.

V
Vladimir Korotenko, 2022-04-18
@firedragon

account blocking https://theitbros.com/active-directory-disable-account/
transfer to another location

Get-ADUser $name| Move-ADObject -TargetPath 'OU=nonactive,OU=compny,DC=domain,Dc=net'

and what about the mail is not completely clear, if it is blocked in hell, then the whack will be

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question