Combine CSV columns from multiple sources into one

Hi, 
I am trying to import column from one CSV file and output it into additional columns on a Get-MailboxStatistics | Export-CSV command. The issue with the script I have created is that when use an Expression to create the new column it outputs all of the items
in the column from the import CSV into one row. See script below, I have highlighted the expressions that are not working.
Any assistance would be appreciated. 
[Array]$Global:NotesMailSizeMaster = (Import-Csv c:\usermigration.csv).MailSizeMaster
[Array]$Global:NotesMailSizeRefresh = (Import-Csv c:\usermigration.csv).MailSizeRefresh
[Array]$Global:UserAlias = (Import-Csv c:\usermigration.csv).Alias
if (!(Get-PSSnapin |
Where-Object { $_.name -eq "Microsoft.Exchange.Management.PowerShell.Admin" }))
ADD-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
$Output = ForEach ($Alias in $UserAlias)
{ Get-MailboxStatistics $Alias | select-object DisplayName, ServerName, StorageGroupName, Database, @{ Name = "TotalItemSize"; expression = { $_.TotalItemSize.Value.ToMB() } },
@{ Name = "NotesMailSize(PreRefresh)"; expression = { $NotesMailSizeMaster } }, @{
Name = "NotesMailSize(PostRefresh)"; expression = { $NotesMailSizeRefresh }
$filename = (Get-Date).ToString("yyyyMMdd")
$Output | export-csv -Path c:\"$filename-mailboxstats.csv" -NoTypeInformation

There's a lot wrong with this script:
1.  You're importing the same file 3x; you should import one and reference the things you need out of it.
2.  If the CSV has more than one row in it, your .notation you're using to access the MailSizeMaster, MailSizeRefresh, and Alias properties is used incorrectly.  If you are trying to reference each of those properties from an array of different entries,
the proper way would be:
$Import = @(Import-Csv C:\usermigration.csv)
$MailSizeMaster = $Import | Select-Object MailSizeMaster
OR
$MailSizeMaster = $Import | Select-Object -Expand MailSizeMaster
...the "OR" is not PowerShell. 
3.  I don't know if you can concatenate different objects with the select-object cmdlet like you are.  However, what you could do is create a custom object to load the values into and then output that object:
$filename = (Get-Date).ToString("yyyyMMdd")
foreach ($item in $Import) {
$MS = Get-MailboxStatistics $item.Alias
New-Object PSObject -Property @{
'DisplayName' = $MS.DisplayName
'ServerName' = $MS.ServerName
'StorageGroupName' = $MS.StorageGroup
'Database' = $MS.Database
'NotesMailSizePre' = $item.MailSizeMaster
'NotesMailSizePost' = $item.MailSizeRefresh
} | Select-Object DisplayName,ServerName,StorageGroupName,Database,NotesMailSizePre,NotesMailSizePost | Export-Csv -NoTypeInformation "C:\$($filename)-mailboxstats.csv"

Similar Messages

  • How can i import the data from multiple sources into single rpd in obiee11g

    how can i import the data from multiple sources into single rpd in obiee11g

    Hi,
    to import from multiple data sources, first configure ODBC connections for respective data sources. then you can import data from multiple data sources. When you import the data, a connection pool will create automatically.
    tnx

  • Items from multiple folders into one?

    Any programs that can move thing's out of multiple folders into one?
    I'm thinking in particular iPhoto, roll folders with images inside, want to move them all out and into one folder. I would rather not go through each one and move manually as could take a while, especially if there are say hundreds of folders each with photos inside i want to move into one.
    Must be a program or something that will do it?

    I find one:
    http://www.macupdate.com/info.php/id/29405/bundle-files
    I've never tested it and it has no reviews. Proceed at your own risk.
    EDIT: Make that three!
    Also, http://gotoes.org/sales/CopyMoveFilesSingleFolderMultiple/HowTo_Move_Files_To_SingleFolder.php
    ...and
    http://www.macupdate.com/info.php/id/25597/the-big-mean-folder-machine
    -mj
    Message was edited by: macjack

  • Collecting data from multiple rows into one column

    I'd like to run a query and put a collection of items into one output column instead of multiple rows. See the example below:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Prod
    PL/SQL Release 10.2.0.5.0 - Production
    "CORE     10.2.0.5.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
         CREATE TABLE "SKIP"."INGREDIENTS"
       (     "INGRED_ID" NUMBER,
         "INGRED_NAME" VARCHAR2(20 BYTE),
         "STORES" VARCHAR2(20 BYTE)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.INGREDIENTS
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (1,'SEA SALT','Food lion');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (2,'TABLE SALT','Food lion');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (3,'FLOUR','Piggly Wiggly');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (4,'YEAST',null);
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (5,'BEER','ABC Store');
      CREATE TABLE "SKIP"."PRETZELS"
       (     "PRETZEL_ID" NUMBER,
         "PRETZEL_NAME" VARCHAR2(20 BYTE),
         "PRETZEL_DESC" VARCHAR2(100 BYTE)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.PRETZELS
    Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (1,'CLASSIC','Classic knot pretzel');
    Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (2,'THICK STICK','Straight pretzel, abt 1/2" in dia');
      CREATE TABLE "SKIP"."INGRED_XREF"
       (     "PRETZEL_ID" NUMBER,
         "INGRED_ID" NUMBER
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.INGRED_XREF
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,1);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,2);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,4);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,2);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,3);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,5);
    --  Constraints for Table INGRED_XREF
      ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("PRETZEL_ID" NOT NULL ENABLE);
      ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("INGRED_ID" NOT NULL ENABLE);
    {code}
    Desired output (note how the ingredients are all listed in one column, separated by commas):
    {code}
    PRETZEL_ID PRETZEL_NAME     PRETZEL_DESC                        INGREDIENTS
    1          CLASSIC          Classic knot pretzel                SEA SALT, TABLE SALT, YEAST
    2          THICK STICK      Straight pretzel, abt 1/2" in dia   TABLE_SALT, FLOUR, BEER

    See the FAQ : {message:id=9360005}
    Especially links concerning string aggregation.

  • Combine Columns From Separate Arrays Into One Formatted Table

    What I'm trying to do is make two WMI queries with 2 different classes for a list of machines and then patch the columns together into one single array that is formatted as a table with columns and rows. I seem to keep banging my head against the wall and
    I can't help but feel that the answer is simple. I can certainly create an array that contains all 3 columns (such as in the commented out part) but no matter which angle I go at it, it always seems to end up as all the data in one single row in each column
    rather than a nicely formatted table. I've even tried constructing separate custom objects and adding the different objects to the array but that's obviously not working. Below is the code of the last thing I tried. I need someone to bash it to death and tell
    me the (most likely obvious) thing that I'm doing wrong. Thanks!
    $failedos = @()
    $failedcs = @()
    $ccs = get-adcomputer -property operatingsystem -filter {name -like "*-CC*"} | select name | sort name
    $cs = foreach ($cc in $ccs){$cc.name | % {if ($c=get-wmiobject -computername $cc.name -class win32_computersystem -ErrorAction SilentlyContinue){$c | select @{Name="Name";Expression={$_.Name}}, @{Name="Model";Expression={$_.Model}}} else {$failedcs += "$_"}}}
    $os = foreach ($cc in $ccs){$cc.name | % {if ($o=get-wmiobject -computername $cc.name -class win32_operatingsystem -ErrorAction SilentlyContinue){$o | select @{Name="OperatingSystem";Expression={$_.caption}}} else {$failedos += "$_"}}}
    #[array]$osprops = @{'Name'=$cs.Name;'Model'=$cs.Model;'OperatingSystem'=$os.OperatingSystem}
    $result = @()
    Foreach ($Line in $cs) {
    $MyCustomObject = New-Object -TypeName PSObject
    Add-Member -InputObject $MyCustomObject -MemberType NoteProperty -Name "Name" -Value $Line.name -Force
    Add-Member -InputObject $MyCustomObject -MemberType NoteProperty -Name "Model" -Value $Line.Model -Force
    $result += $MyCustomObject
    foreach ($Line2 in $os) {
    $MyCustomObject2 = New-Object -TypeName PSObject
    Add-Member -InputObject $MyCustomObject2 -MemberType NoteProperty -Name "OperatingSystem" -Value $Line2.OperatingSystem -Force
    $result += $MyCustomObject2

    Any help?
    $ccs = get-adcomputer -property operatingsystem -filter {name -like "*-CC*"} |
    select -ExpandProperty name | sort
    $Result =
    Foreach ($CC in $CCs)
    $Object =
    New-Object PSObject -Property @{ Name = $CC
    Model = 'Failed'
    OperatingSystem = 'Failed'
    Try {
    $Object.Model =
    get-wmiobject -computername $CC -class win32_computersystem -ErrorAction Stop |
    select -ExpandProperty Model
    $Object.OperatingSystem =
    get-wmiobject -computername $CC -class win32_operatingsystem -ErrorAction Stop |
    select -ExpandProperty Caption
    Catch{}
    Finally { $Object }
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Selecting from multiple tables, into one internal table

    Hi,
    What is the best & most efficient method of selecting from multiple table (in my case 6,) into one internal table?
    Thanks,
    John
    Points will be rewarded and all responses will be highly appreciated.

    I have simple example :
    First one - Join 5 tables
    data : f1 type i,
              f2 type i,
              f3 type i.
    start-of-selection.
    get run time field f1.
    write the query 4 or 5 tables join.
    get run time field f2.
    f3 = f2 - f1 ( Total time).
    Second one - joins 3 table and use for all entries
    data : f1 type i,
              f2 type i,
              f3 type i.
    start-of-selection.
    get run time field f1.
    write the query 3 tables join and use for all entries
    get run time field f2.
    f3 = f2 - f1. ( Total time )
    Finally you can have time diffrence between the both sql statement.

  • Merging events from multiple calendars into one calendar

    I am using iCal version 2.0.5 on Mac OS 10.4.11.
    Right now, there are 3 separate calendars setup in iCal: Personal, Home and Unfiled. What I would like to do is merge all of the events from these calendars into the Personal calendar and then delete the other two calendars (Home and Unfiled). Is there any trick to easily doing this?
    Thanks,
    Andrew

    Andrew,
    Welcome to Apple Discussions.
    Before you do anything else, use iCal>File>Back up Database..., and save the backup to your Desktop.
    Then use iCal>File>Export... for the Calendars that you want to merge into "Personal", and then delete Home/Unfiled from your CALENDARS sources pane.
    Next click on the exported copies on the Desktop and you will be presented with an "Add Events" window which will allow you to choose "Import" into the Personal Calendar.
    If everything is working as desired use Back up Database... for the new setup.
    ;~)

  • How to fetch data from different sources into one source (like into Ztable)

    hi friends,
    As per our client requirements they want to develope an Inventory and an Ontime delivery report in BO on top of Oracle database.
    Situation is some thing like they have ECC 6.0.and they want to collect all inventory and ontime delivery data at one place.According to me that could be one Ztable in which we can gather all data.Apart from that they are going to use Data Integrator in which they can directly fetch the data from R/3 system(They dont want to have BI system) and put all data in Oracle DB.On top of ORacle BO person can develop BO reports.
    My question is how to fetch all data at one place and what are the tables going to be use.
    kindly help me out as its very important project.
    Thanks
    Abhishek

    The following is my standard reply to those who need to get old data from a backup in one account and add it to another account.  The method described here may be applied to your case.  It would be a bit of a long process, though.
    When connected to the account you want to GET data from, Go to Settings>iCloud and turn all data that is syncing with iCloud (contacts, calendars, etc.) to Off. 
    When prompted choose to keep the data on the iPhone. 
    After everything is turned off, scroll to the bottom and tap Delete Account.  Next, set up a new iCloud account using a different Apple ID and turn iCloud data syncing for contacts, etc. back to On.  When prompted, choose Merge.  This will upload the data to this new account.
    Note that this only affects the "Apple data" like contacts, calendars, reminders, etc.  Many third party apps also use iCloud to store data files there.  These files may be lost in the process, unless the apps also keep the data locally on the device.
    NOTE:  Photos in the photo stream (if you use it) will not transfer to the new account.  It is advised that you save the photos to a computer before performing the account switch. 

  • Add Text From Multiple Fields Into One

    I'm creating a form in Acrobat 9 that lets you fill in information for four cars. For each of the four cars, there is a text box for Manufacturer, Model, and Year. I have the boxes labeled Manuf1, Mod1, Year1, Manuf2, Mod2, etc.
    Then I two other text boxes called Text1 and Text2. In Text1 I want all the manufacturers listed together( example: Ford, Chevy, BMW) and the same thing for the models in Text2. What would be even better would be if in Text1 and Text2 the names could be seperated with "or".
    Is there a javascript that can do this and not repeat a name (if, for example, the first two cars were both Ford, the third was BMW and the fourth was Chevy, I want Text1 to display: Ford or BMW or Chevy, not: Ford or Ford or BMW or Chevy)?
    Thank you for the help!

    The code sample you provided is using AcroForm scripting and will not work in this form. There is another post similar to this one...have a look at this one it might help you out. It is doing the opposite of what you want but the concept of the loop and how each field is addressed inside ofthe loop is what you wil need.
    http://forums.adobe.com/message/2954517#2954517
    Paul

  • Copy text from multiple fields to one field

    I would like to copy text from multiple fields into one field. Each of these smaller fields will only be allowed to have one character. The larger field will not be able to be edited.
    So far, I have thought of creating a naming heirarchy for these fields. I was going to then call upon the array of the parent and set the value of the parent to equal this array.
    var parent = this.getField("everything");
    var array = everything.getArray();
    var v;
    for(parent=0; parent<array.length; parent++)
    v = a + " " + v;               //Im guessing this line is incorrect
    parent.value = a;
    Any suggestions? or a better way of doing this.
    Thanks

    The code sample you provided is using AcroForm scripting and will not work in this form. There is another post similar to this one...have a look at this one it might help you out. It is doing the opposite of what you want but the concept of the loop and how each field is addressed inside ofthe loop is what you wil need.
    http://forums.adobe.com/message/2954517#2954517
    Paul

  • How do I turn off automatic bookmark creation when combining multiple PDFs into one?

    When I combine multiple PDFs into one, I need Adobe to use the CUSTOM bookmarks I created in the original PDFs. I do NOT want the additional PDF name as a bookmark in this instance. Is there a way to turn this option OFF in Acrobat Professional? I have version 9.

    You can not automatically turn off this action nor can you remove the 'file_name.pdf' heading, but you could add a button or menuitem to remove the 'file_name.pdf' from the bookamarks. Yes, it is one more step to perform when combining PDFs, but is you want until you have all of the PDFs combined you only need do it once.
    Removing filename bookmarks created by Acrobat by Sean Stewart
    From the above article:
    "With the release of Acrobat 6 came the ability to create a composite (binder) document from multiple files, (i.e. File > Create PDF > From Multiple Files.) When this is done, Acrobat automatically inserts a new top level bookmark at the start of each new file. The bookmark title will correspond to the source filename of the source file. While this level of separation can be helpful, it is counterproductive when the user wants the bookmark tree in the merged document to be continuous.
    "Here's a sample JavaScript to remove the top level bookmarks from the bookmark tree. This script will look for a ".pdf" extension to decide whether to remove the bookmark."
    With some additional coding you can add menu item or toolbar button.

  • Combine multiple drawings into ONE SHEET

    Hello, this is a question on Acrobat Pro, ver 8, using Windows XP. I guess I understand how to combine multiple files into a single PDF-file. However, this morning I happened to see the option mentioned in the subject line. When you go to "Combine files" > "Getting started with combined files" and select "CAD drawings" the description reads: "Combine multiple drawings into one sheet that's easy to navigate and print". How can this be done? I need to combine 8 ea CAD drawings (already converted to PDF) into ONE SHEET for printing without having the need taping 8 pieces of paper together. Arranging the drawing within the CAD application is not an option because the files were delivered by a 3rd party company and they only deliver PDFs

    Hi Priya,
      You can do this by merging the requets.
       1. goto Se10 and right click on the request and seelct merge requests.
       2. It will ask you from request and to request. Give the request names.
       3. After merging first request contents will be added to second request and
           first request will be deleted.
      Like that you can merge 3 requests to one request.
      Let me know if you want more info.  
    Thanks & Regards,
    Siri.

  • How To Concatenate Column Values from Multiple Rows into a Single Column?

    How do I create a SQL query that will concatenate column values from multiple rows into a single column?
    Last First Code
    Lesand Danny 1
    Lesand Danny 2
    Lesand Danny 3
    Benedi Eric 7
    Benedi Eric 14
    Result should look like:
    Last First Codes
    Lesand Danny 1,2,3
    Benedi Eric 7,14
    Thanks,
    David Johnson

    Starting with Oracle 9i
    select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
    from
    (select last, first, code, row_number() over(partition by last, first order by code) rn
    from a)
    connect by last = prior last and first = prior first and prior rn = rn -1
    start with rn = 1
    group by last, first
    LAST       FIRST      CODES                                                                                                                                                                                                  
    Lesand         Danny          1,2,3
    Benedi         Eric           7,14Regards
    Dmytro

  • How can I combine multiple pdfs into one document?

    I need to consolidate multiple docs into one.  How do I do that?

    It's pretty easy. Open multiple PDF documents in Apple Preview that came with your Mac. Choose View/Thumbnails so you can see the page thumbnail icons. Select any number (or all) of the page thumbnail icons of one document and drag them to any point in the thumbnails of another document.
    For example you can drag page 6 of one PDF between pages 40 and 41 of another PDF doc. But it sounds like you want to select all pages of one PDF and drag them to the end of another PDF doc.
    If you need more powerful document combining you can use PDFpen or Adobe Acrobat Professional, but they cost money.

  • HT4059 I'm trying to organize my PDFs in iBooks on my ipad2 and I can't figure out how to combine multiple PDFs into one. Any thoughts?

    I'm trying to organize my PDFs in iBooks on my ipad2 and can't figure out how to combine multiple PDFs into one. Any thoughts?

    I'm trying to organize my PDFs in iBooks on my ipad2 and can't figure out how to combine multiple PDFs into one. Any thoughts?

Maybe you are looking for

  • PIX/ASA site-to-site VPN config question

    Do I need to specify the source IP address & mask in my access-list that's referenced in the crypto map "match address" line or can I just say "any"? If I want to send certain traffic to one tunnel and other traffic to a different tunnel based solely

  • How can I re-release the Customizing request

    Hi, Yesterday, I released a customizing request to QAS. At the QAS, I used the T-code STMS to check the import request, I could not find out it. But, today, I released another customizing request to QAS. I can find out it. I don't known what had happ

  • How to get album art on your iPod nano. Read this.

    I have had problems getting artowrk on my nano from my computer but it was only because I didnt have USB 2.0 outlets on my computer. I used a different computer that had USB 2.0 and it worked fine. Just click the little button under your sources in i

  • HDCP monitor/tv

    i do a lot of final cut studio work and i recently sold my g5 for a MBP since i do a lot more onset editing. However, I was looking to create more workspace by adding another monitor. After looking around, i decided to get something that had HDCP cap

  • IPhone 6. How do I enable emoji keyboard? It is listed in settings/general/keyboards but I cannot highlight?

    iPhone 6.  How do I enable emoji keyboard in apps.  It is listed in settings/general/keyboards under English but I see no where to turn it on or use it.