RE: Off Topic Remote Exchange Powershell Issues.
I think I reported this during the E15 TAP but there was no backport. Try this: Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 $error.clear() $mb = get-mailbox xx $mb | get-InboxRule | export-csv pete.csv $mb | export-csv pete2.csv The problem is that get-InboxRule can't figure out what server it is supposed to be talking to and it doesn't take a -Server parameter. From: Pfefferkorn, Pete (pfeffepe) [mailto:pfeff...@ucmail.uc.edu] Sent: Friday, March 22, 2013 1:17 PM To: MS-Exchange Admin Issues Subject: Off Topic Remote Exchange Powershell Issues. This is a little off topic but I've been banging my head against a wall trying to figure it out. We have Exchange 2010 SP2. We have a virtual machine which we setup that runs all our scripts against Exchangeprovisioning, de-provisioning, reporting monitoring etc. I have dozens of scripts running on that box that run fine except for a couple that just won't run correctly in the task scheduler. If I run them adhoc on that box...not a problem. The scheduler doesn't report any errors either but I don't get results. Simple test is as follows: Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 $error.clear() get-InboxRule -mailbox xx | export-csv pete.csv get-mailbox xx | export-csv pete2.csv The get-mailbox works fine when it runs from the scheduled task. The get-inboxRule nada. Blank file. Task is set to run with highest priv. Powershell versions match. If I run this on one of our Exchange servers as a scheduled task...not a problem. I can put these couple of scripts on one of the servers but I would rather figure out the problem and get them back on our management box. In the Event Viewer I see under Windows PowerShell events 403, 400, and 600 For Engine and Provider Lifecycle. In the Exchange event I see two events recorded and event ID 6 and Event ID 8. I'm thinking it's a piping issue but I would think it would fail in both circumstances ad-hoc and as a task. Log Name: MSExchange Management Source:MSExchange CmdletLogs Date: 3/22/2013 1:09:38 PM Event ID: 8 Task Category: (1) Level: Error Keywords: Classic User: N/A Computer: UCMAILMGR.ad.uc.edu Description: The description for Event ID 8 from source MSExchange CmdletLogs cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer. If the event originated on another computer, the display information had to be saved with the event. The following information was included with the event: Log Name: MSExchange Management Source:MSExchange CmdletLogs Date: 3/22/2013 1:09:38 PM Event ID: 8 Task Category: (1) Level: Error Keywords: Classic User: N/A Computer: UCMAILMGR.ad.uc.edu Description: The description for Event ID 8 from source MSExchange CmdletLogs cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer. If the event originated on another computer, the display information had to be saved with the event. The following information was included with the event: 1620 5 Get-InboxRule Get-InboxRule System.InvalidOperationException: Operation is not valid due to the current state of the object. at Microsoft.Exchange.Data.Storage.ExchangePrincipal.get_ServerFullyQualifiedDomainName() at Microsoft.Exchange.Data.Storage.MailboxSession.Initialize(MapiStore linkedStore, LogonType logonType, ExchangePrincipal owner, DelegateLogonUser delegateUser, Object identity, OpenMailboxSessionFlags flags, GenericIdentity auxiliaryIdentity) at Microsoft.Exchange.Data.Storage.MailboxSession.<>c__DisplayClass12.b__10(MailboxSession mailboxSession) at Microsoft.Exchange.Data.Storage.MailboxSession.InternalCreateMailboxSession(LogonType logonType, ExchangePrincipal owner, CultureInfo cultureInfo, String clientInfoString, IAccountingObject budget, Action`1 initializeMailboxSession, InitializeMailboxSessionFailure initializeMailboxSessionFailure) at Microsoft.Exchange.Data.Storage.MailboxSession.CreateMailboxSession(LogonType logonType, ExchangePrincipal owner, DelegateLogonUser delegateUser, Object identity, OpenMailboxSessionFlags flags, CultureInfo cultureInfo, String clientInfoString, PropertyDefinition[] mailboxProperties, IList`1 foldersToInit, GenericIdentity auxiliaryIdentity, IAccountingObject budget) at Microsoft.Exchange.Data.Storage.MailboxSession.ConfigurableOpen(ExchangePrincipal mailbox, MailboxAccessInfo accessInfo, CultureInfo cultureInfo, String clientInfoString, LogonType logonType, PropertyDefinition[] mailboxProperties, InitializationFlags initFlags, IList`1 foldersToInit, IAccountingObject budget) at Microsoft.Exc
RE: Off Topic Remote Exchange Powershell Issues.
Can't say for sure, but this part looks suspicious: System.InvalidOperationException: Operation is not valid due to the current state of the object. at Microsoft.Exchange.Data.Storage.ExchangePrincipal.get_ServerFullyQualifiedDomainName() at Microsoft.Exchange.Data.Storage.MailboxSession.Initialize(MapiStore linkedStore, LogonType logonType, ExchangePrincipal owner, DelegateLogonUser delegateUser, Object identity, OpenMailboxSessionFlags flags, GenericIdentity auxiliaryIdentity) One notable difference between running the script yourself and running it from a scheduled task is the logon type (interactive vs. batch). From: Pfefferkorn, Pete (pfeffepe) [mailto:pfeff...@ucmail.uc.edu] Sent: Friday, March 22, 2013 12:17 PM To: MS-Exchange Admin Issues Subject: Off Topic Remote Exchange Powershell Issues. This is a little off topic but I've been banging my head against a wall trying to figure it out. We have Exchange 2010 SP2. We have a virtual machine which we setup that runs all our scripts against Exchangeprovisioning, de-provisioning, reporting monitoring etc. I have dozens of scripts running on that box that run fine except for a couple that just won't run correctly in the task scheduler. If I run them adhoc on that box...not a problem. The scheduler doesn't report any errors either but I don't get results. Simple test is as follows: Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 $error.clear() get-InboxRule -mailbox xx | export-csv pete.csv get-mailbox xx | export-csv pete2.csv The get-mailbox works fine when it runs from the scheduled task. The get-inboxRule nada. Blank file. Task is set to run with highest priv. Powershell versions match. If I run this on one of our Exchange servers as a scheduled task...not a problem. I can put these couple of scripts on one of the servers but I would rather figure out the problem and get them back on our management box. In the Event Viewer I see under Windows PowerShell events 403, 400, and 600 For Engine and Provider Lifecycle. In the Exchange event I see two events recorded and event ID 6 and Event ID 8. I'm thinking it's a piping issue but I would think it would fail in both circumstances ad-hoc and as a task. Log Name: MSExchange Management Source:MSExchange CmdletLogs Date: 3/22/2013 1:09:38 PM Event ID: 8 Task Category: (1) Level: Error Keywords: Classic User: N/A Computer: UCMAILMGR.ad.uc.edu Description: The description for Event ID 8 from source MSExchange CmdletLogs cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer. If the event originated on another computer, the display information had to be saved with the event. The following information was included with the event: Log Name: MSExchange Management Source:MSExchange CmdletLogs Date: 3/22/2013 1:09:38 PM Event ID: 8 Task Category: (1) Level: Error Keywords: Classic User: N/A Computer: UCMAILMGR.ad.uc.edu Description: The description for Event ID 8 from source MSExchange CmdletLogs cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer. If the event originated on another computer, the display information had to be saved with the event. The following information was included with the event: 1620 5 Get-InboxRule Get-InboxRule System.InvalidOperationException: Operation is not valid due to the current state of the object. at Microsoft.Exchange.Data.Storage.ExchangePrincipal.get_ServerFullyQualifiedDomainName() at Microsoft.Exchange.Data.Storage.MailboxSession.Initialize(MapiStore linkedStore, LogonType logonType, ExchangePrincipal owner, DelegateLogonUser delegateUser, Object identity, OpenMailboxSessionFlags flags, GenericIdentity auxiliaryIdentity) at Microsoft.Exchange.Data.Storage.MailboxSession.<>c__DisplayClass12.b__10(MailboxSession mailboxSession) at Microsoft.Exchange.Data.Storage.MailboxSession.InternalCreateMailboxSession(LogonType logonType, ExchangePrincipal owner, CultureInfo cultureInfo, String clientInfoString, IAccountingObject budget, Action`1 initializeMailboxSession, InitializeMailboxSessionFailure initializeMailboxSessionFailure) at Microsoft.Exchange.Data.Storage.MailboxSession.CreateMailboxSession(LogonType logonType, ExchangePrincipal owner, DelegateLogonUser delegateUser, Object identity, OpenMailboxSessionFlags flags, CultureInfo cultureInfo, String clientInfoString, PropertyDefinition[] mailboxProperties, IList`1 foldersToInit, GenericIdentity auxiliaryIdentity, IAccountingObject budget) at Microsoft.Exchange.Data.Storage.MailboxSession.ConfigurableOpen(ExchangePrincipal m