PowerShell Exchange 2007 Question To count up the total number of email addresses (view/hidden) per GAL

Hello All:
I am very new to Power Shell and need some help:
I have 224 GAL's on our Exchange System (Ex 2007) where, I need to count the total number of email addresses/display names assigned to each GAL.  I am not sure how to set up a for-next loop in PowerShell.  I am not sure how to set a  input
file/variable, with the names of each GAL.  (GAL is Global Address List)
I think it's $GALLIST = 'NameofGal1, NameofGal2, etc thru to NameofGaln' where n is the last GAL in the list.
So I need to now a command which would get all the gal names (Get-AddressList(?) for all the GAL's in the Exchange System and then pipe them into a function to count the number of email addresses.
In making a start with the following code and got stuck:
Get-Mailbox | Where {$_.GlobalAddressList -eq “GAL” -and $_.} | Select-Object Displayname, EmailAddresses, count
Missing or invalid property reference or expression.
At line:1 char:71
+ Get-Mailbox | Where {$_.GlobalAddressList -eq "GAL" -and $_.} <<<<  | Select-Object Displayname, EmailAddresses, count
I think I know how to pipe the results to a csv file - with - Export-Csv  -path c:\filename.csv - NoTypeInformation.
Please can someone advise.  Please help.
Thanks in advance
PS - is there a way to access, read and display variable name and value which stores the number of email addresses/per GAL in exchange 2007 database so you don't have carry out a count exercise.  Because this metadata will be in the Exchange DB? 
Would this be easier to get?
Started building conditional statement:
Get-Mailbox | Where {$_.GlobalAddressList -eq "GAL" AND {{HiddenFromAddressListsEnabled -eq $True} OR {HiddenFromAddressListsEnabled -eq $False}} |
If {{HiddenFromAddressListsEnabled -eq $True} | Select-Object Displayname, EmailAddresses, count ELSE {HiddenFromAddressListsEnabled -eq $False}} | Select-Object Displayname, EmailAddresses, count
ENDIF
Export-Csv -path c:\test.csv -NoTypeInformation
Will this work?  Checking to see how to do a for-next loop.
$GAL = Get-GlobalAddressList
foreach($GAL IN $GAL)
Get-Mailbox | Where {$_.GlobalAddressList -eq $GAL AND {{HiddenFromAddressListsEnabled -eq $True} OR {HiddenFromAddressListsEnabled -eq $False}} |
If {{HiddenFromAddressListsEnabled -eq $True} | Select-Object Displayname, EmailAddresses, count AS "Count of Hidden Addresses" ELSE {HiddenFromAddressListsEnabled -eq $False}} | Select-Object Displayname, EmailAddresses, count AS "Count of 
Visible Addresses" |
Export-Csv -path c:\test.csv -NoTypeInformation |
not sure if this works and looks spaghetti -like!

Hi Everton,
In addition, If you want to export GlobalAddressList, please refer to the script below:
$filter = (Get-GlobalAddressList 'Default Global Address List').RecipientFilter
#filter HiddenFromAddressListsEnabled is ture
Get-Recipient -RecipientPreviewFilter $filter | Where-Object {$_.HiddenFromAddressListsEnabled -eq $ture} | Select-Object Name,PrimarySmtpAddress
#filter HiddenFromAddressListsEnabled is false
Get-Recipient -RecipientPreviewFilter $filter | Where-Object {$_.HiddenFromAddressListsEnabled -eq $false} | Select-Object Name,PrimarySmtpAddress
Refer to:
How to Export the Exchange 2010 Default Global Address List (GAL)
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Similar Messages

  • Determine the fax number or EMAIL address for pur docs

    Hi,
    I am trying to send pur doc via fax or EMAIL.
    I have created specific  message types for that purpose.
    The fax is created and sent to the default fax number / EMAIL address.
    I want the message to be sent to the same vendor but to other fax number or EMAIL address.
    I do not want to create a spereate partner for that purpose. I want to add fax number or EMAIL number to the address detail of the vendor and I want to mark it as the fax number for the pur docs.
    In the UE/BADI I want to be able to determine the fax number / EMAIL address.
    Does any one know any BADI/UE enabeling me doing so?
    Best regards
    Shlomo Assouline

    Dear Ramesh,
    This is a known issue. What I am looking for is the place in which I can decide which one of the EMAIL/FAX that exists in the vendor master data to use.
    As you probably know A vendor can have more than one EMAIL/FAX but only one of them is signed as the default one. The EMAIL/FAX used as standard is the standard one.
    Best regards
    Shlomo Assouline

  • Use Windows PowerShell to count and list total number of items in Folders E-Mail in Office Outlook?

    I have the need to generate a list of all outlook folders and the total number of items listed beside each folder name. I thought I could simply modify the script from " http://blogs.technet.com/b/heyscriptingguy/archive/2009/01/26/how-do-i-use-windows-powershell-to-work-with-junk-e-mail-in-office-outlook.aspx
    " regarding the total number of items in the junk folder but no luck.
    I thought I could just simply duplicate line 6 of the aforementioned script
    "$folder = $namespace.getDefaultFolder($olFolders::olFolderJunk) " and change the folder name but getting the "Method invocation failed because [Microsoft.Office.Interop.Outlook.OlDefaultFolders] does not contain a method
    named 'olFolder'.
    At line:7 char:1
    + $folder = $namespace.getCurrentFolder($olFolders::olFolder("Design Engineering S ...
    I've found a way to export a list of all these folders using exportoutlookfolders.vbs to a txt file but doesn't include total number of items.
    Looking for any pointers on how to make this work. Don't expect anyone to write it for me but I am still learning PS. Would be great to find a way to import all of these folder and subfolder names into the script. Will be appreciative of any advice though.
    There's an enormous amount of Outlook folders.
    Outlook 2013
    Windows 8
    Thanks,
    Barry

    Since I am not and administrator, but an end user, I do not have access to the Get-Mailxxxx commandlets to make this really easy and had to do this long hand.
      The following will pull folder.name, folder.items.count, and sum the total size of each folder's items for all folders and their subs. 
    Just one warning, the summation can take some time with a large PST file since it needs to read every email in the PST. 
    There is also some minor formatting added to make the results a little more readable.
    $o
    = new-object
    -comobject outlook.application 
    $n
    = $o.GetNamespace("MAPI") 
    $f
    = $n.GetDefaultFolder(6).Parent 
    $i
    = 0
    $folder
    = $f
    # Create a function that can be used and then re used to find your folders
    Function
    Get-Folders()
    {Param($folder)
     foreach($folder
    in $folder.Folders)   
    {$Size =
    0
    $Itemcount
    = 0
    $foldername
    = $folder.name
    #Pull the number of items in the folder
    $folderItemCount
    = $folder.items.count
    #Sum the item (email) sizes up to give the total size of the folder
    foreach ($item
    in $folder.Items)
    {$Itemcount
    = $Itemcount
    + 1
    $Size =
    $Size +
    $item.size
    Write-Progress -Activity ("Toting size of "
    + $foldername
    + " folder.")
    -Status ("Totaling size of "
    + $Itemcount
    + " of "
    + $folderItemCount
    + " emails.")
    -PercentComplete ($itemcount/$folderItemCount*100)
    # just a little formating of the folder name for ease of display
    While($foldername.length
    -le 19){$foldername
    = $foldername
    + " "}
    #Write the results to the window
    Write-Host ("-folder "
    + $foldername
    + "  
    -itemcount " +
    "{0,7:N0}" -f
    $folderItemCount +
    "   -size " +
    "{0,8:N0}" -f ($size/1024)
    + " KB")
    #If the folder has a sub folder then loop threw the Get-Folders function.
    #This two lines of code is what allows you to find all sub folders, and
    #sub sub folders, and sub sub sub for as many times as is needed.
    If($folder.folders.count
    -gt 0)
    {Get-Folders($folder)}
    get-folders($folder)

  • TS3899 Sending a meeting invite from Exchange 2007 account located in Central Time from Outlook 2010 Email Client located in Eastern Time cause meeting to show up 1 hour early on iPhone

    Sending a meeting invite from Exchange 2007 account located in Central Time from Outlook 2010 Email Client located in Eastern Time cause meeting to show up 1 hour early on iPhone.

    The meeting invite is being sent from a Computer through the Outlook 2010 Email Client. Both Computer and Outlook 2010 are set to Eastern Time. The OWA (Outlook Web Access) for the 2007 account is set to Eastern Time. The Outlook 2010 Email Client is connected to an Exchange 2007 account and the Exchange server for the exchange 2007 account is located in Chicago (Central Time) and is set to Central Time. When the meeting invite is sent from the Outlook 2010 Client the recipient receives the invite on his/her iPhone(set and located in the Eastern Time Zone) and a mime-attachment.ics file is attached to the meeting invite email. There is no info displayed in the subject line or message body. If the iPhone user opens the attachment it displays the meeting date and time and any other info that was sent from Outlook. The Outlook 2010 user sets the meeting for 10:00am to 11:00am. when the meeting invite mime-attachment.ics file is opened on the iPhone the meeting is displayed as 9:00am to 10:00am. if the iPhone user adds the ics file to his/her calendar it adds a meeting event that is scheduled 1 hour earlier than it is supposed to be. I had the iPhone user to set Time Zone support on and off and there is no change.

  • Can't remember my security questions and can't access my back up email address is there a way of getting the information sent to another email?

    Can't remember my security questions and can't access my back up email address is there a way of getting the information sent to another email?

    No. You need to ask Apple to reset your security questions; ways of contacting them include phoning AppleCare and asking for the Account Security team, clicking here and picking a method for your country, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (103501)

  • How to exclude last page from the total number of pages counter

    Hi,
    I am customizing the payables remittance RTF template, our requirement is to reset page number to 1 for each payment, i am able to achieve this using "@section"
    also we have a requirement to have a summary page at the end, i am able to get this using "start@last-page:body".
    issue is last page is also considered in the page counter of the last payment.
    i.e. suppose if i am generating remittance for 2 payments which are printing details in two pages and one page respectively, my output will have total 4 pages and it's showing
    Payment1 page-1 footer -> 1 of 2
    Payment1 page-2 footer -> 2 of 3
    Payment2 page-3 footer -> 1 of 2
    Summary page-4 footer -> 2 of 2
    but i wanted to see
    Payment1 page-1 footer -> 1 of 2
    Payment1 page-2 footer -> 2 of 3
    Payment2 page-3 footer -> 1 of 1
    Summary page-4 footer -> 1 of 1
    Any idea how to remove the summary page from the page counter.
    Rgds,
    -Kamal

    I'm not sure how it was in Acrobat 9, but in XI you add a Header/Footer and
    one of the options it "Page Number and Date Format", where you can select
    the format of the page number to add, some of them contain the total number
    of pages (such as "1 of n").

  • HT5787 Hallo , i don't remember the answer to my security questions and my apple ID is my old Email address whice not active any more and i don't have access to it

    Hallo , i don't remember the answer to my security questions and my apple ID is my old Email address whice not active any more and i don't have access to it.
    During the last year i was using my Iphone under this APPLE ID :***** , but i forgot to change it on "FIND MY IPHONE"
    is there a solution for that??
    Kind regards
    yossi
    <Email Edited By Host>

    If you changed your Apple ID from the old email address (that is showing up) to a new one, but just forgot to update it on your iPhone, try these steps.
    1. Use your current Apple ID password
    Trying using your current Apple ID password. If that doesn't work, continue to the next step.
    2. Sign out and back in to iMessage or FaceTime
    If you are currently signed in to iMessage or FaceTime
    Sign out of iMessage or FaceTime:
    iMessage: Go to Settings > Messages > Send & Receive, tap your Apple ID, then tap Sign Out.
    FaceTime: Go to Settings > FaceTime, tap your Apple ID, then tap Sign Out.
    Sign back in to iMessage or FaceTime:
    iMessage: Go to Settings > Messages, then tap "Use your Apple ID for iMessage".
    FaceTime: Go to Settings > FaceTime, then tap "Use your Apple ID for FaceTime".
    You should now be able to sign out of iCloud. You will still see your previous Apple ID when signing out.
    If you are not signed in to iMessage or FaceTime
    Sign in to iMessage or FaceTime:
    iMessage: Go to Settings > Messages, then tap "Use your Apple ID for iMessage".
    FaceTime: Go to Settings > FaceTime, then tap "Use your Apple ID for FaceTime".
    You should now be able to sign out of iCloud. You will still see your previous Apple ID when signing out.
    3. Change your Apple ID temporarily
    If signing out and back in to iMessage or FaceTime didn't work, try these steps:
    Change your Apple ID to the Apple ID you used previously. You shouldn't need to verify the email address.
    Tap Settings > iCloud and try to sign out.
    Change your Apple ID to the new email address that you want to use. You'll need to verify the email address.
    Tap Settings > iCloud and sign in with the new Apple ID.

  • I can't remember my security questions and have used the maximum number of tries, how do I find out what my answers are so I can log in and buy some music?

    I can't remember my security questions and have used the maximum number of tries, how do I find out what my answers are so I can log in and buy some music?

    From a Kappy  post
    The Best Alternatives for Security Questions and Rescue Mail
    1.  Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
    2.  Call Apple Support in your country: Customer Service: Contact Apple support.
    3.  Rescue email address and how to reset Apple ID security questions.
    An alternative to using the security questions is to use 2-step verification:
    Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID.

  • Okay, so please disregard my last question.  I had the page set up in vector view.  Hmmmm, ridiculous.

    okay, so please disregard my last question.  I had the page set up in vector view.  Hmmmm, ridiculous.  THanks, though, if you took the time to research my idiocy, I appreciate it.

    So this is not the computer that the device normally syncs with, iTunes is working exactly as designed.

  • HT5312 I forget answers to security questions,on the other hand rescue email address that Apple use to send me email is not correst,how I can reset security questions or change rescue email ?

    I forget answers to security question , on the other hand rescue email address that Apple use to send me email is not correct , how I can reset security questions or change and make correction for rescue email address ?
    Please send me answer to [email protected] or [email protected]
    Thank you

    You need to contact Apple. Click here, phone them, and ask for the Account Security team.
    (87669)

  • HT5787 Help, I have forgotten my Apple ID security questions and when i send it to my email address to reset the questions nothing shows up in inbox. Any other way to get past this?

    Help, I have forgotten my Apple ID security questions and when i send it to my email address to reset the questions nothing shows up in inbox. Any other way to get past this?

    You've checked the spam folder on your rescue email account as well as the inbox, and you've tried clicking the reset link a second time ? If you have, and you still haven't received the email, then you will need to contact iTunes Support / Apple to get the questions reset.
    Contacting Apple about account security : http://support.apple.com/kb/HT5699

  • Help, I have forgotten my Apple ID security questions and when i send it to my email address to reset the questions nothing shows up in inbox. Any other way to get past this?

    Help, I have forgotten my Apple ID security questions and when i send it to my email address to reset the questions nothing shows up in inbox. Any other way to get past this?

    Security questions:
    https://discussions.apple.com/docs/DOC-4551
    http://support.apple.com/kb/HT5312
    This is also useful:
    http://www.macworld.co.uk/ipad-iphone/news/?newsid=3463233&olo=email
    If you don’t know your security questions, phone Apple (using the number listed here:  http://support.apple.com/kb/HE57  ) and ask for the Account Security Team.

  • HT204053 I have just installed IOS7, having reset the security questions I have been asked for a Rescue Email address. I have entered my primary address, this is not valid. I have added another of my hotmail addresses and the process will not continue. I

    I have just installed IoS7 on my I Phone. Having reset the security questions I have been ask for a Rescue Email address. My primary address is not acceptable, I have tried other addresses put but the process will not forward. I cannot go back, my phone now will not function. The Rescue Email address keeps appearing. Help please.

    Did you check the email account for a verification email from Apple?  You may need to respond by clicking the Verify Now link before the new rescue address will be accepted.

  • I have a question about the new version of itunes. in the old version at the bottom of the sceen it display the total number of media and the size of the files. how can i get the new version to diplay this?

    in the old version at the bottom of the sceen it displayed the total number of media and the size of the files. how can i get the new version to diplay this?

    You're welcome. It was frustrating for me as well until I stumbled across "the fix"

  • How count the total number of instances ?

    I have 2 scenarios :-
    1. How to get the total number of instances of  the node  in a BO?
    eg :
    businessobject BO1   {
    element BO_ID;
                       node NODE1 [0..n]
                         element Node_ID;
                         element Status ;
                         element value:
    I want to get total number of the NODES instances in the particular instance of the BO1.   !!!?????
    2. I want to  make some calculations based on the attributes of the NODE1 , in the   BeforeSave .absl  of the Business Object BO1.
    eg:
    something like this :-
    In BeforeSave of BO1.absl -
    for ( all the instances in NODE1 )
    {   if (NODE1.status == true)
                 sum = sum + NODE1.value
    Please help !!!!

    Your approach is correct.
    You can use a standard Query or create your own Query to run through Datainstances.
    Documentation with examples for Queries in ABSL see here: https://my020062.sapbydesign.com/sap/ap/ui/repository/SAP_BYD_WEKTRA/CP/sapLSUIContentPlayerTestPage.html?manifest=067D03A7602B1D490899DF46B5082089&COMPONENT=A1S_PDI&RELEASE=260&LANGUAGE=en&REGION=&INDUSTRY=&TASK=CR_VIEW&sap-language=EN
    Looking / Clincking  for "SAP Business ByDesign Scripting Language" and "Syntax for Implementation of Actions and Events" and "Query"

Maybe you are looking for

  • One library with multiple devices with different accounts?

    Here is the setup: *(1) Windows XP PC with iTunes and (1) Library *(1) iPhone and (1) iPad with iTunes Account A *(1) iPad with iTunes Account B *(1) iTouch with iTunes Account C Is it possible to have one iTunes Library where we can all have our mus

  • Wireless keyboard stopped working caps lock light does not come on but on mac mini unable to log in

    Any help out there would be appreciated. Never had this problem before until now.. Mac mini was asleep. pressed space bar on keyboard.. machine woke up now i can't type anything. restarted the machine and now i can't log in. can only do it through my

  • Problem in entering Target Quantity for scheduling agreement

    Hi All, While I create a new Scheduling agreement and enter teh target quantity system throws an error showing that target value is too large. But I want to enter the same quantity & can't reduce the same.  while seeing the help of the error it says

  • How an 3.x object is migrated to 7.0 at the table level?

    Hi All, in the context menu of an 3.X object . There is an option called "Migate". when we click this option , The 3.x object is migated to 7.0 object. Can anyone please tell me how does the system "migrate" at the table level. What tables are affect

  • WAV Audio Track 2 silent when rendered

    Using CS4/    i7 & 8 gig ram. Thanks so much for your help in the past. I've just noticed something strange. On the past couple of projects, the following happens: Using Bill's suggestion, I changed the mp3 over to WAV with Audacity.  Everything work