header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
output variable value + column header
Last Post 13 Aug 2010 03:11 AM by Marco Shaw (MVP). 3 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Resolved
destnUser is Offline
New Member
New Member
Posts:15
Avatar

--
12 Aug 2010 05:37 AM
    Hi,

    Probably not so hard, but I can't find it..

    When I run this command in a script:

    -----------

    $usr.MBSize = Get-MailboxStatistics -id $usr.SamAccountName -ErrorVariable Err -ErrorAction SilentlyContinue | Select-Object @{n="TotalItemSize(MB)";e={$_.totalitemsize.Value.ToMB()}}

    $usr | export-csv expfile.csv

    ------------


    If I open my expfile.csv than I see following output:
    "Name","SamAccountName","mail","Company","lastlogon","mbSize"
     "bla bla","blabla01","blab@blab.com","company","10/08/2010 19:28:20","@{TotalItemSize(MB)=150}"

    How can I get rid of "TotalItemSize(MB)" in my csv ?

    Marco Shaw (MVP)User is Offline
    Veteran Member
    Veteran Member
    Posts:1642
    Avatar

    --
    12 Aug 2010 07:23 PM
    Try going with just this instead:
    $usr.MBSize=(Get-MailboxStatistics -id $usr.SamAccountName -ErrorVariable Err -ErrorAction SilentlyContinue).totalitemsize.Value.ToMB()
    Marco

    *Microsoft MVP - Windows PowerShell
    https://mvp.support.microsoft.com/profile/Marco.Shaw
    *Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
    *Blog - http://marcoshaw.blogspot.com
    destnUser is Offline
    New Member
    New Member
    Posts:15
    Avatar

    --
    13 Aug 2010 12:29 AM
    Hm Okay, I feel stupid now.. :)

    Case closed.
    Marco Shaw (MVP)User is Offline
    Veteran Member
    Veteran Member
    Posts:1642
    Avatar

    --
    13 Aug 2010 03:11 AM
    Don't feel stupid. I would have tried your code first.
    Marco

    *Microsoft MVP - Windows PowerShell
    https://mvp.support.microsoft.com/profile/Marco.Shaw
    *Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
    *Blog - http://marcoshaw.blogspot.com
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer