Do powershell Hashes have a max length?

Posted on 2011-10-07
Last Modified: 2012-05-12

I'm trying to pull data from multiple places and put it into one place. Doing so, I'm taking the inputs, spliting them, and then grabbing what I need into a single string. Then I'm exporting that string into a single line. The doc, in the end, will have multiple lines, but that's besides the point. I have everything working just fine and exporting all the data that I need except for one thing. When I open the final doc it has "..." at the end of the string (IE Key=Hello Value=Worl..."). Obviously the values are much larger (though I do not believe any will be more than 255 chars).

I'm wondering if using powershell hashes to compile data has a limit to what the value can be? It seems that anything which is more than 140 chars ends up with a "..." on the output value. Is there a method which will allow the output value to be larger within a hash?

Because this is giving me all the output I want, I'd prefer not to change how I'm grabbing the data, but rather just increase the size allowed by the powershells, hash, value. If possible.

Let me know. Thanks.


Question by:Alex_MPM

    Author Comment

    I appologize, but I was wrong. The length before it displays the "..." is not a fixed length. It actually varies throughout the document, but is not related to any one element. Here's a version of the script which completes the same task.

    $inputfile = gc "<my place to store docs>"
    $i = @()
    $output = @{}
    foreach ($line in $inputfile) {
        $i = $line.split(",")        #split each line on the comma to separate and access each cell individually
        if ($output.ContainsKey($i[14])) {
            $output[$i[14]] += $i
                    #This is the second and each suplemental tenant.
        } else {
            $output.Add($i[14], ($i))
                    #This line creates the beginning of the line, which contains the initial name, email, address ect...
                    # of the first tenant. Every additional tenant will be done above.
    $output | Out-File "<my place to store docs>"

    Open in new window

    LVL 3

    Accepted Solution

    Yes, by default it is limited to the width of your Powershell window.

    You can get around it two ways.
    You can change the width of the txt file by putting -width 375 (or any number that works for your data) ex Out-File 'filename.txt' -width 375
    Or use Export-CSV  'filename.csv' -notype for you output.

    Author Comment

    That's exsactly what I needed.

    Thank you man.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    A post on a forum I visit frequently mobilized me to create a script to remove a password (the one required to open a file) from any number of Word files. Because nobody would want to open a 100 files and manually save them... Of course, you have t…
    Why would I want to create a function for tracking messages? I am glad you asked. As with most monotonous/routine tasks, human error tends to creep in after doing the same task over and over again. By creating a function, you load the function once…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now