none
Exchange 2007 Powershell Question RRS feed

  • Question

  • I am working on streamlining a script I have for user conversions, I have a working model that pulls information from a csv but want to change the process as building the csv takes time.

    I define my variables as you see below, then run commands that need the information provided by variables. They constantly fail with the error "Disable-Mailbox : Cannot convert 'System.Object[]' to the type 'Microsoft.Excha
    nge.Configuration.Tasks.MailboxIdParameter' required by parameter 'Identity'. S
    pecified method is not supported."

    Variables:

    $email = Get-ADUser -Identity $line.old -properties emailaddress | sort-object emailaddress | Select-object -ExpandProperty emailaddress
    $alias = Get-Mailbox -identity $email |Select-Object Alias | Format-Table -hidetableheaders
    $ExGUID = Get-Mailbox -identity $email |Select-Object ExchangeGUID | Format-Table -hidetableheaders
    $ExDatabase = Get-Mailbox -identity $email |Select-Object Database | Format-Table -hidetableheaders
    $ExDispName = Get-Mailbox -identity $email |Select-Object DisplayName | Format-Table -hidetableheaders

    Commands:

    Disable-Mailbox -Identity $alias -Confirm:$False

    Connect-Mailbox -Identity $ExGUID -Database $ExDatabase -User $line.new -Alias $alias -Confirm:$False

    Does anyone have any ideas? This same method of collection works for active directory powershell

    Monday, September 30, 2013 7:14 PM

All replies

  • Hi,

    Would you explain what are you trying to do ?


    MCITP - Exchange 2010 | MCITP - Windows Server 2008 R2

    Tuesday, October 1, 2013 12:47 PM
  • I received an answer,the below change gets me the result I desired.
    $alias = Get-Mailbox -identity $email |Select-Object -ExpandProperty Alias 
    Thursday, October 3, 2013 3:07 PM