• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1400
  • Last Modified:

Do powershell Hashes have a max length?

Hey,

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.

Regards,

Alex
0
Alex_MPM
Asked:
Alex_MPM
  • 2
1 Solution
 
Alex_MPMAuthor Commented:
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

0
 
LindySCommented:
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.
0
 
Alex_MPMAuthor Commented:
That's exsactly what I needed.

Thank you man.

Cheers,
Alex
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now