Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - exchange - disable-mailuser

Reply
 
Old 10-28-2009   #1 (permalink)
IT Staff


 
 

exchange - disable-mailuser

Add-PsSnapin Quest.ActiveRoles.ADManagement
Add-PsSnapin Microsoft.Exchange.Management.PowerShell.Admin

$dn = get-qaduser <samaccountname?| foreach {$_.dn}
Disable-MailUser -Identity $dn

Error : Disable-MailUser : "microsoft.com/ou1/test123 is not a mail-enabled
user.


Looks like disable-mailuser expects a string in this format
"microsoft.com/ou1/test123"

Is there a way that make Disable-MailUser -Identity <samaccountname > ?




My System SpecsSystem Spec
Old 4 Weeks Ago   #2 (permalink)
Karl Mitschke


 
 

Re: exchange - disable-mailuser

Hello IT,
Quote:

> Add-PsSnapin Quest.ActiveRoles.ADManagement
> Add-PsSnapin Microsoft.Exchange.Management.PowerShell.Admin
> $dn = get-qaduser <samaccountname?| foreach {$_.dn} Disable-MailUser
> -Identity $dn
>
> Error : Disable-MailUser : "microsoft.com/ou1/test123 is not a
> mail-enabled user.
>
> Looks like disable-mailuser expects a string in this format
> "microsoft.com/ou1/test123"
>
> Is there a way that make Disable-MailUser -Identity <samaccountname >
> ?
>
Disable-MailUser DOES work with a samaccountname. You aren't giving it a
samaccount name.

Since you know the samaccount name, you can skip the quest stuff and do:

Disable-MailUser -Identity <samaccountname>

Karl


My System SpecsSystem Spec
Old 4 Weeks Ago   #3 (permalink)
Rob Campbell


 
 

RE: exchange - disable-mailuser

It looks like if found the user, but they just weren't mail-enabled. If it
can't resolve the name at all you get an error about "object <identity>
could not be found on domain controller.

"IT Staff" wrote:
Quote:

> Add-PsSnapin Quest.ActiveRoles.ADManagement
> Add-PsSnapin Microsoft.Exchange.Management.PowerShell.Admin
>
> $dn = get-qaduser <samaccountname?| foreach {$_.dn}
> Disable-MailUser -Identity $dn
>
> Error : Disable-MailUser : "microsoft.com/ou1/test123 is not a mail-enabled
> user.
>
>
> Looks like disable-mailuser expects a string in this format
> "microsoft.com/ou1/test123"
>
> Is there a way that make Disable-MailUser -Identity <samaccountname > ?
>
>
>
> .
>
My System SpecsSystem Spec
Old 4 Weeks Ago   #4 (permalink)
IT Staff


 
 

Re: exchange - disable-mailuser

This is how i test it.

a) Powershell 1.0 on XP, with Exhcnage shell console installed. Created a
ps1 script and run using domain admin

Add-PsSnapin Microsoft.Exchange.Management.PowerShell.Admin
Add-PsSnapin Microsoft.Exchange.Management.Powershell.Support
Disable-MailUser -Identity <samaccountname>

==> error

b) Run direct from Exchange shell console with domain admin.
Disable-MailUser -Identity <samaccountname>

==> works and no error.

How do i run from script instead of running interactively from (b)


My System SpecsSystem Spec
Old 4 Weeks Ago   #5 (permalink)
Karl Mitschke


 
 

Re: exchange - disable-mailuser

Hello IT,
Quote:

> This is how i test it.
>
> a) Powershell 1.0 on XP, with Exhcnage shell console installed.
> Created a ps1 script and run using domain admin
>
> Add-PsSnapin Microsoft.Exchange.Management.PowerShell.Admin
> Add-PsSnapin Microsoft.Exchange.Management.Powershell.Support
> Disable-MailUser -Identity <samaccountname>
>
> ==> error
>
> b) Run direct from Exchange shell console with domain admin.
> Disable-MailUser -Identity <samaccountname>
>
> ==> works and no error.
>
> How do i run from script instead of running interactively from (b)
>
What is the error this time?

Karl


My System SpecsSystem Spec
Old 4 Weeks Ago   #6 (permalink)
IT Staff


 
 

Re: exchange - disable-mailuser

managed to resolve it


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Disable exchange email for one domain user - SBS 2003 SBS Server
disable-mailuser doesn't remove WindowsEmailAddress PowerShell
BPR states /Exchange-oma local path does not match /Exchange SBS Server
Exchange 07 Shell - Export-Mailbox and Disable-Mailbox cmdLETS PowerShell
Question about Exchange Management Console and Exchange cmdlets PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46