I want to disable exchange mail account via script. This script will run in custom command.

I write a script like this.

"Disable-Mailbox -identity %mailNickname% -confirm:$false"

But i get an error message "The term disable-mailbox is not recognized as the name of a cmdlet ....."

I think that I must import a module that it is recognize this command.

Any one suggest something

Thanks in advanced.

by (40 points)

1 Answer

by (216k points)
0 votes

Hello Erkan,

Starting from Adaxes 2013.1, you can access Exchange functions with Adaxes ADSI API. To disable the Exchange mailbox of the user, on which the Custom Command is executed, you can use the following script:

$Context.TargetObject.DeleteMailbox()

Related questions

I have tried it using the Custom Commands Action "Add the user to a group", which only allows me to add the user to one group at a time, and can't use the multiple DNs that the ... I can't get it to work. Could you assist me in finding the best way to do this?

asked Jan 16, 2024 by dominik.stawny (280 points)
0 votes
1 answer

I need to connect to Exchange Online using specific service principal, but I am getting error I am trying to authenticate via Connect-ExchangeOnline -AccessToken $token - ... btw aka 3.8.0 version of the ExchangeOnlineManagement module is used automatically.

asked 4 days ago by KIT (1.0k points)
0 votes
1 answer

Or is there another solution to solve this?

asked Sep 15, 2022 by boris (570 points)
0 votes
1 answer

We are currently working on automating the property patterns. So far we were able to add all the needed properties to a Property Pattern via PowerShell script apart from the ... 't quite match the "should be" screenshot. Any help would be much appriciated.

asked Apr 30, 2020 by MichaelM (60 points)
0 votes
1 answer

Currently, when I disable a user account in Adaxes, the group memberships of the user remain intact. I'd like to automate the removal of group memberships such as distribution ... a list of groups/DL that the user was previously in and removed from. Thanks!

asked Nov 3, 2021 by jayden.ang (20 points)
0 votes
1 answer