April 16, 2014 at 7:38 pm #14602
I am running a Powershell script that contains Exchange Shell cmdlets.
I followed the instructions here to setup a remote connection to Exchange Shell.
However, the created connection appears to only return output for only the first command.
My simple test script :
Get-TransportConfig | Select Identity, MaxRecipientEnvelopeLimit Get-TransportConfig | Select Identity, MaxReceiveSize
Only the first command regarding MaxRecipientEnvelopeLimit returns a value. The next command does not return anything. When I switch the commands around, the same happens, only the 1st command runs.
Any help is appreciated.
April 17, 2014 at 2:22 am #14608
Maybe you nede to post the contents of your function. Hard to help without it
April 17, 2014 at 6:54 am #14612
There are some known problems I've heard of regarding Exchange and implicit remoting. I'll see if I can point someone to look at this, who might have more experience.
April 17, 2014 at 7:55 am #14614
I can confirm this is an issue, although I can't explain it. I ran the commands directly on a server with Exchange 2010 SP3 to eliminate any remoting issues. Server is running Windows Server 2008 R2 with SP1. PowerShell version is 2.
April 17, 2014 at 8:02 am #14615
@Tore Groneng: My script has no functions, it is exactly what I have quoted in my 1st post 🙂
@Don Jones: Thanks for the help.
@mike F Robbins: Yes, you hit it spot on, this is what I get as well. I am running Exchange 2013 on Server 2012. Powershell Version 3. So apparently the issue persists in later versions..
Interestingly, if I try another set of Exchange cmdlets, it works to a certain extent. Take for example,
Get-RemoteDomain | select identity, DeliveryReportEnabled
Get-PopSettings | fl -property LoginType
It outputs perfectly fine. But when rearrange the positioning and add in other cmdlets, everything goes awry again.
April 17, 2014 at 8:38 am #14619
April 17, 2014 at 8:39 am #14620
April 17, 2014 at 8:39 am #14621
OK, I obviously have no idea how to use the markup here to add a link:
April 18, 2014 at 2:18 am #14625
Okay I sort of solved it, although I am not sure if this is the right method.
I piped the cmdlets to "Select" instead of "Format-List", and it worked.
April 17, 2014 at 8:03 am #14616
Jut saw that Rob Campbell (@mjolinor) posted on twitter that it's an issue with the default formatting. Piping it to Format-List shows the properties:
April 17, 2014 at 8:25 am #14617
It's because the first command sets the pipeline up for only the Identity and MaxRecipientEnvelopeLimit properties. When the second command runs, the pipeline doesn't know anything about the MaxReceiveSize property so only the Identity property results are displayed for that command (the second one). You could jam any two commands together and have the same issue.
Notice the handles property doesn't show up in the results of this script and the second row for the id property is blank:
April 17, 2014 at 8:38 am #14618
April 18, 2014 at 1:30 am #14624
@jeffrey Smith : Thanks for the link, will try to digest it.
@mike F Robbins : Thanks for the explanation. But now I ran into another problem.
Format-List will conflict with some of the cmdlets that already use Format-List. Output formatting is hard to handle properly =/
For instance, this script will not work when I execute it with Format-List. ( ./script1 | fl )
It will spew errors.
"Maximum size of received emails : \r\n" Get-TransportConfig | Select Identity, MaxReceiveSize "\r\n" "Password Policy Settings : \r\n" Get-ActiveSyncMailboxPolicy | fl -property DevicePasswordHistory Get-ActiveSyncMailboxPolicy | fl -property DevicePasswordExpiration "\r\n"
note: I have replaced the escape character with a \ instead.
You must be logged in to reply to this topic.