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.mspxI 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 Harris
Start Free Trial