0 votes

I wrote a small script to get Mail Queue stats on all my Exch 2010 Hub Tansport servers. It works in EMS but when I configure as a Custom Command it returns an error; "Cannot invoke this function because the current host does not implement it. " Can you assist in getting this fixed?

add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
$HubServer = Get-TransportServer |sort-object -property Name
foreach ($server in $HubServer) {
get-Queue -server $server -EA inquire -SortOrder -messagecount
write-output ""
}

by (350 points)

1 Answer

0 votes
by (216k points)

Michael,

The Get-Queue cmdlet prompts for user confirmation. Unfortunately, this is not supported by Adaxes. You will not be able to use the Get-Queue cmdlet in Custom Commands.

0

This is the message received when attempting to run the script you provided directly from the Adaxes Powershell

PS C:\scripts> .\Get-MailQueueAD.ps1

Confirm
The queue viewer client can't process the results received from the server. The
data may be corrupted.
[Y] Yes [A] Yes to All [H] Halt Command Suspend [?] Help
(default is "Y"):

0

Hello Michael,

Try this version of the script, it works successfully in our testing environment:

$exchangeServer = "exchangeserver.domain.com" # TODO: Modify me

$session = new-pssession -connectionURI "http://$exchangeServer/powershell?serializationLevel=Full" -ConfigurationName Microsoft.Exchange
Import-PSSession -session $session

$HubServer = Get-TransportServer | sort-object -property Name
foreach ($server in $HubServer)
{
    $queueInfos = Get-Queue -server $server -EA inquire -SortOrder -messagecount
    foreach ($queueInfo in $queueInfos)
    {
       $message = "Identity: " + $queueInfo.Identity + "; DeliveryType: " + $queueInfo.DeliveryType
       $Context.LogMessage($message, "Information")
    }
}
Remove-PSSession -Session $session
0

Now recieving this error:

Run PowerShell script 'Check Mail Delivery Queue Status' for the user

Identity: ; DeliveryType:
Connecting to remote server failed with the following error message : WinRM cannot process the request. The following error occured while using Kerberos authentication: The network path was not found. Possible causes are: -The user name or password specified are invalid. -Kerberos is used when no authentication method and no user name are specified. -Kerberos accepts domain user names, but not local user names. -The Service Principal Name (SPN) for the remote computer name and port does not exist. -The client and remote computers are in different domains and there is no trust between the two domains. After checking for the above issues, try the following: -Check the Event Viewer for events related to authentication. -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport. Note that computers in the TrustedHosts list might not be authenticated. -For more information about WinRM configuration, run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic. <output truncated>

0

Michael,

This error means that Adaxes cannot establish a remote PowerShell session with the computer where your Exchange Server is installed. The possible errors are specified in the error message that you posted.

The most probable reason is that you specified a DNS alias for this computer in $exchangeServer. Try specifying the Fully Qualified Domain Name (FQDN) or the Flat Name of the computer where your Exchange Server is installed.

0

Inserting the FQDN seems to have worked. Thank you for your assistance!

Related questions

0 votes
1 answer

I found these codes: http://www.adaxes.com/sdk/SampleScripts ... lFlow.html I created custom command(action is "run powershell script") with the following codes and added ... host does not implement it. Can anyone help me look into this ? Really appreciate!

asked Jul 7, 2015 by tony (50 points)
0 votes
1 answer

Hey guys, First time Adaxes user, and let me say, we absolutely love the product! Quick question though.... As a part of our account de-provisioning process, we ... exact same code in a regular powershell window with no problem. Any thoughts? Any alternatives?

asked Sep 6, 2012 by sco.robinso (20 points)
0 votes
1 answer

Hi there ! I wan to implement a custom command that will remove a user from all disitribution groups : Import-Module Adaxes Get-AdmGroup -Filter { mail -like "*" } | Where { ( ... host does not implement it. I can't see what i'm doing wrong... Thanks Stephen

asked Sep 27, 2011 by sroux (800 points)
0 votes
1 answer

hello, I have somethings like this : #Start the process on the remote machine $Context.LogMessage("Get statistivcs on %cn%", "Information") $Server = New-PSSession -ComputerName ... main script so I can see $a in $Context.LogMessage. is that possible? Thanks.

asked Feb 13, 2018 by tentaal (1.1k points)
0 votes
1 answer

Hello, Based on your script, we check whether there is already a request. However, we often get the following error and do not know why. Can you help us? ... Cannot compare "Softerra.Adaxes.Adsi.Search.AdmSearchResult" because it is not IComparable. Thank you

asked 2 days ago by DRiVSSi (280 points)
3,346 questions
3,047 answers
7,772 comments
544,973 users