Advertisement

07.29.2008 at 04:58AM PDT, ID: 23603619
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

Unique Hash Table for counting purposes

Asked by DaleHarris in MSH/Monad PowerShell

Tags:

This should be a fairly straightforward solution.

I'm using a Powershell script to count all the "full" mailboxes on our exchange server.  It should query all mailboxes, and then if it's between a range of size, then output (append) to a text file.

Then the Hash table comes into play.  It does a get-content on the txt file (which should be a list of names only)
The names are in the format of Last, First MI Title or Last, First Title.
And there are even a few that don't even meet those requirements.
But I'm hoping that doesn't matter.

So it takes all that data and pushes it into an array or hash table.

In this hash table, you'll find a list of base keys, and a count of the times it shows up in the document.

I used the format from this website:
http://www.microsoft.com/technet/scriptcenter/topics/msh/payette1.mspx

I tried to copy it verbatim, but it's not showing up right either because I don't have the requisite information in the same format or because my spaces in the names are causing issues.  What I mean by verbatim is I tried the exact same sequence with my variables instead, and I couldn't even get that to work.  Usually you can get their stuff to work, but not after you try to tweak it.

So the end state is this

Doe, John         9

Meaning, there are 9 occurrences of Doe, John in the text file (he has had a full mailbox for 9 days total).  This script is supposed to run every day manually, which would mean that it appends to the list every time it runs.  Ideally, I could see if a person has had a full mailbox for 10 days or 30 days or whatever based on the amount of times their name is in the text file.

I think I've explained enough, and the code I created is kind of broken, so it doesn't help to post it here seeing as the link to the page has all the information I was going off of.

Btw, I was able to get a text file full of full mailboxes no problem.

I just couldn't get the hash table to work correctly.  This could be done with an array, but hash tables make more sense IMO.

If/when you find the solution to this, can you explain what you parsed it from (a notepad with a few names in it, some duplicates, separated by each line).

Here's my attempt at psuedo code:

Get all names from a text file and put it into a variable
Take that variable, and create a hash table
Make a variable called $DaysFullTotal that is similar to $frequency used in the website I posted above
Sort by descending for days full and output to the screen

Any help would be greatly appreciated, but there's no real time crunch on this.  So I can wait for a highly polished, highly understood write up or at least guidelines to follow so I can make it.  I admit that my grasp of hash tables needs some work, so I'm using this question for educational purposes also.

-Dale HarrisStart Free Trial
 
Loading Advertisement...
 
[+][-]07.29.2008 at 05:19AM PDT, ID: 22110641

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MSH/Monad PowerShell
Tags: Powershell C2 (CTP2)
Sign Up Now!
Solution Provided By: BSonPosh
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.29.2008 at 06:16AM PDT, ID: 22111079

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628