none
Am getting "@{01test=addr1} when I should be getting ... well, just "01test" RRS feed

  • Question

  • Am working on a script to pull PrimarySMTPaddress based on WindowsLiveID.  I have a csv file of WindowsLiveIDs.  I save the contents variable $List = import-csv -path path\file.csv ... The next step is a foreach:

    foreach($addressin$list) {get-mailbox$address|select-objectPrimarySMTPaddress,displayName,windowsliveid}

    Which errors out, as this becomes a hashtable:

    Cannot convert value "@{01test=addr1}" to type "Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter".

    The table is for every ID in the list (in this instance, "01test" is the first in the list, "addr1" is the second.  This continues as "01test" is compared against every other address e.g. "addr1", "addr2" "addr3" and so on).  Of course, just  { $address } instead of get-mailbox is fine.  Have not done much with Powershell lately, and am sure I'm just missing something though at this point am not sure what. 

    Thanks for any help,

    --Joe

    Monday, September 29, 2014 7:37 PM

Answers

  • Oh ... darn ...

    RTFM ... this failed because I did not have a header in the CSV file.  When I put one in -- actually, I just changed to:

    $head="Address"

    $list = Import-Csv-Path$mypath$myinfile1-header$head

    Everything worked as it should have ... oh well.

    --Joe

    Monday, September 29, 2014 8:18 PM

All replies

  • Try adding -ExpandProperty afther the Select-Object
    Monday, September 29, 2014 7:57 PM
  • Oh ... darn ...

    RTFM ... this failed because I did not have a header in the CSV file.  When I put one in -- actually, I just changed to:

    $head="Address"

    $list = Import-Csv-Path$mypath$myinfile1-header$head

    Everything worked as it should have ... oh well.

    --Joe

    Monday, September 29, 2014 8:18 PM