Exchange Server GAL with Powershell

Hi ,

I want to workout the following solutions for GAL like

Get - GAL

Add - GAL

Update- GAL

Remove - GAL

Can anybody help on how can i do that through powershell? When i searched for existed commands like "Get-Command *GetAddress* " i didn't get any cmdlets related to Global Address List.

Is Get-MsolUser for GAL as well? I am in confusion.

September 1st, 2015 12:41pm

Hi,

Take a look here: https://technet.microsoft.com/en-us/library/aa996579(v=exchg.150).aspx

Commands are:

Get-GlobalAddressList

New-GlobalAddressList

Remove-GlobalAddressList

Set-GlobalAddressList

Thanks.

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 1:05pm

Hi,

Please refer to these below articles to know about above commands:

https://technet.microsoft.com/en-us/library/bb123785(v=exchg.150).aspx

https://technet.microsoft.com/en-us/library/bb124368(v=exchg.150).aspx  

https://technet.microsoft.com/en-us/library/aa998806(v=exchg.150).aspx

Regards,

David 


September 1st, 2015 9:56pm

But all these commands not existed on my powershell? It is giving an error like command not recognized.
Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 10:01pm

Hi,

I guess you may type wrong commands.

Please post the command you have typed here for further analysis.

Also add the detailed error message you have seen.

Regards,

David

September 2nd, 2015 2:15am

I am executing the following command

Get-GlobalAddressList

Getting the below error message.

Get-GlobalAddressList : The term 'Get-GlobalAddressList' is not recognized as
the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1

Thanks

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 3:14am

Hi,

I ran the command ,you can see the below result:

[PS] C:\Windows\system32>Get-GlobalAddressList

Name                                                        RecipientFilter
----                                                        ---------------
Default Global Address List                                 ((Alias -ne $null) -and (((ObjectClass -eq 'user') -or (...

Note: You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you.

So I suggest you can use the adiminstorator role to test.

Regards,

David 

September 2nd, 2015 3:49am

I am executing in same manner , Do i need to install any exchange related module in powershell?

PS C:\Users\myname> Get-Credentialcmdlet Get-Credential at command pipeline position 1Supply values for the following parameters:


CredentialUserName                                                                           Password--------   
--------myname@xyz.com                                                                    System.Security.SecureStringPS


C:\Users\myname> Get-GlobalAddressList


Get-GlobalAddressList : The term 'Get-GlobalAddressList' is not recognized as the name of a cmdlet, function, scriptfile, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correctand try again.At line:1 char:1+ Get-GlobalAddressList+ ~~~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : ObjectNotFound: (Get-GlobalAddressList:String) [], CommandNotFoundException    + FullyQualifiedErrorId : CommandNotFoundExceptionPS C:\Users\mannedinesh> Get-CommandsGet-Commands : The term 'Get-Commands' is not recognized as the name of a cmdlet, function, script file, or operableprogram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.At line:1 char:1+ Get-Commands+ ~~~~~~~~~~~~    + CategoryInfo          : ObjectNotFound: (Get-Commands:String) [], CommandNotFoundException    + FullyQualifiedErrorId : CommandNotFoundException


Also in Exchange Server Admin i have the rights to do the following for that user.

Address Lists

Public Folders


  • Edited by Prima-d 23 hours 6 minutes ago some
Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 4:23am

Hi,

I ran the command ,you can see the below result:

[PS] C:\Windows\system32>Get-GlobalAddressList

Name                                                        RecipientFilter
----                                                        ---------------
Default Global Address List                                 ((Alias -ne $null) -and (((ObjectClass -eq 'user') -or (...

Note: You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you.

So I suggest you can use the adiminstorator role to test.

Regards,

David 

September 2nd, 2015 7:47am

Hi,

I ran the command ,you can see the below result:

[PS] C:\Windows\system32>Get-GlobalAddressList

Name                                                        RecipientFilter
----                                                        ---------------
Default Global Address List                                 ((Alias -ne $null) -and (((ObjectClass -eq 'user') -or (...

Note: You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you.

So I suggest you can use the adiminstorator role to test.

Regards,

David 

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 7:47am

I am executing in same manner , Do i need to install any exchange related module in powershell?

PS C:\Users\myname> Get-Credentialcmdlet Get-Credential at command pipeline position 1Supply values for the following parameters:


CredentialUserName                                                                           Password--------   
--------myname@xyz.com                                                                    System.Security.SecureStringPS


C:\Users\myname> Get-GlobalAddressList


Get-GlobalAddressList : The term 'Get-GlobalAddressList' is not recognized as the name of a cmdlet, function, scriptfile, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correctand try again.At line:1 char:1+ Get-GlobalAddressList+ ~~~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : ObjectNotFound: (Get-GlobalAddressList:String) [], CommandNotFoundException    + FullyQualifiedErrorId : CommandNotFoundExceptionPS C:\Users\mannedinesh> Get-CommandsGet-Commands : The term 'Get-Commands' is not recognized as the name of a cmdlet, function, script file, or operableprogram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.At line:1 char:1+ Get-Commands+ ~~~~~~~~~~~~    + CategoryInfo          : ObjectNotFound: (Get-Commands:String) [], CommandNotFoundException    + FullyQualifiedErrorId : CommandNotFoundException


Also in Exchange Server Admin i have the rights to do the following for that user.

Address Lists

Public Folders


  • Edited by Prima-d Wednesday, September 02, 2015 8:24 AM some
September 2nd, 2015 8:21am

Add the user account to the Organization Management group in AD. Note that this gives them full rights in Exchange 2013. More information is here: https://technet.microsoft.com/en-us/library/jj150492(v=exchg.150).aspx

You need these permissions to manage the GAL and run the *-GlobalAddressList cmdlets. 

If you want to view only, you can use the View-Only Management role group instead.

Let me know if that sorts this out for you.

Thanks.

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 12:30pm

Hi,

These statements are executing finely when i run through powershell command prompt. But getting an error while executing them from c# code. Here is the code i wrote.

RunspacePool runspacePool = RunspaceFactory.CreateRunspacePool();
            powershell = PowerShell.Create();
            powershell.RunspacePool = runspacePool;
            command = new PSCommand();
            command.AddCommand("Set-ExecutionPolicy RemoteSigned");
            command.AddScript("Import-PSSession");
            command.AddParameter("Session", result[0]);
            command.AddParameter("CommandName", new[] { "Get-GloabalAddressList", "Get-MailboxStatistics" });
            command.AddParameter("ErrorAction ", "SilentlyContinue ");


            powershell.Invoke();

Getting an error like

"An unhandled exception of type 'System.Management.Automation.PSInvalidOperationException' occurred in System.Management.Automation.dll " "

How can i overcome this error? Is there any wrong in my code?

September 3rd, 2015 6:37am

When i run another command like GET-MAILUSER it is giving the following error in powershell.

The operation couldn't be performed because object 'myemail@myemailcloud.com' couldn't be found on 'SN1PR10A002DC06.NAMPR10A002.PROD.OUTLOOK.COM'.     + CategoryInfo          : NotSpecified: (:) [Get-MailUser], ManagementObjectNotFoundException     + FullyQualifiedErrorId : [Server=SN1PR10MB0800,RequestId=25c5f9c0-2b1b-46bd-b6d3-b710be2bfbb6,TimeStamp=9/3/2015 1:17:47 PM] [FailureCategory=Cmdlet-ManagementObjectNotFoundException] 891455E7,Microsoft.Exchange.Management.RecipientTasks.GetMailUser     + PSComputerName        : ps.outlook.com

Free Windows Admin Tool Kit Click here and download it now
September 3rd, 2015 12:04pm

Hi,

I am not familiar with code , if you have some question about code, I suggest we can ask a question for more help in Microsoft Exchange Development forum :

https://social.technet.microsoft.com/Forums/exchange/en-US/home?forum=exchangesvrdevelopment

Thank you for your understanding.

Regards,

David 

September 4th, 2015 2:28am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics