• Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    After look at the examples you provided me my issue was with my script that was scanning the drives. I added the values ComputerName as suggested by Rob and ran the scripts and all data and lines are matching. Thanks for your time and advice to get me on the right track!

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    Is it possible to attach a sample of the files for the columns on each are very long. The output on this page doesn’t allow it to look normal

     

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    Sorry I was pulled away on another instance, thank you both Rob and Stephen. I worked with both scripts and they perform well however the format is not what I need unfortunately. However I have this script that combines/joins the two csv files line by line but it has a function flips 2 lines¬† after a given number of lines are counted. My…[Read more]

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    Thanks I will work with this one and let you know, again thanks

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    This is great and thanks so much for correcting this for I was not aware. Is it possible to assist me with fixing the script I’m using to combine these two csv’s. It gives me all of the data needed from csv2 but I can’t stop it from manipulating the lines/rows. Is there a way I can use this script without manipulating the rows?

    $lines1 =…[Read more]

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    My primary question is it possible to make this script run without manipulating the lines or rows?

    $lines1 = Get-Content “D:scriptsaudit.csv”
    $lines2 = Get-Content “D:scriptsdrive.csv”
    $destination = “D:scriptstest.csv”

    $length = [Math]::Min($lines1.Length, $lines2.Length)
    for ($index = 0; $index -lt $length; $index++)
    {
    # Append…[Read more]

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    This the script that was provided to me as it scans the drives

    $computerList = “D:scriptscombinedcomputers.txt”
    $outputCSV = “D:scriptscombinedRFV.csv”
    $scriptpath = $MyInvocation.MyCommand.Path
    pushd $dir

    [System.Collections.ArrayList]$sysCollection = New-Object System.Collections.ArrayList($null)

    foreach ($computer in (Get-Content…[Read more]

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    I’m trying to combine csv2 as is to the last column of csv1. When I was first tasked with this, I didn’t think it would be this difficult however I’m experienced with Powershell

     

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    csv1 columns

    computername,lastuser,UserLastLogin,Manufacturer,SystemType,SerialNumber,MemoryGB,ProcessorType,OS,OSVersion,IpAddress,MemroyGB,LastReboot

    CSV2 columns DRIVB,FREEB,DRIVEC,FREEC, and continues through DRIVEZ as we have up to DRIVEW presently

     

     

     

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    The scripts and csv are in the same location. Presently I was trying this script

    $lines1 = Get-Content “D:scriptsaudit.csv”
    $lines2 = Get-Content “D:scriptsdrive.csv”
    $destination = “D:scriptstest.csv”

    $length = [Math]::Min($lines1.Length, $lines2.Length)
    for ($index = 0; $index -lt $length; $index++)
    {
    # Append rows
    Add-Content $destination…[Read more]

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    My apologies to include the rows, right now I’m at 157 rows this may vary from time to time.

     

  • Profile picture of James

    James replied to the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    This information is from the combined csv (there are many more columns and rows from each csv however the rows will be identical in number as the scripts are pulling from the same serverlist.txt.¬† The reason two scripts are run for this information is there are multiple hard drives and each drive needs to be listed on the same row as the computer…[Read more]

  • Profile picture of James

    James started the topic import/combine two csv files in the forum General PowerShell Q&A 1 month ago

    I’m in great need of assistance with a Powershell script to combine to csv files. I need to combine the second csv with all columns continuing with the first csv. Nothing special just combine the two csv’s as is and in the exact order as the original files. However each csv is fairly large. I found one I was working with but some of the rows in…[Read more]

  • Profile picture of James

    James became a registered member 1 month ago