?
Solved

Do powershell Hashes have a max length?

Posted on 2011-10-07
3
Medium Priority
?
1,306 Views
Last Modified: 2012-05-12
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
Comment
Question by:Alex_MPM
  • 2
3 Comments
 

Author Comment

by:Alex_MPM
ID: 36934817
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
 
LVL 3

Accepted Solution

by:
LindyS earned 2000 total points
ID: 36935064
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
 

Author Comment

by:Alex_MPM
ID: 36936525
That's exsactly what I needed.

Thank you man.

Cheers,
Alex
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline

850 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