exchange-server-2010

Import-PSSession fails in script, works in shell

喜欢而已 提交于 2019-12-10 14:22:52
问题 I'm new to Powershell scripting and I'm working on a user management Powershell script, but I have run into a strange error. The following code works when I run it from the shell, but not when it is run from a script: $UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionURI http://servername/Powershell/ -Authentication Kerberos -Credential $UserCredential -AllowRedirection Import-PSSession $Session When I run it in a script with a Param()

Exchange Server Transport Agent Won't Load, “Built By a Newer Runtime”

自古美人都是妖i 提交于 2019-12-08 07:46:56
问题 I have built a simple transport agent (using .NET 4.0) for exchange 2010 and I'm trying to install it using the exchange management shell, but I run across this error: Could not load file or assembly 'file:///C:\Program Files\Microsoft\Exchange Server\V14\Public\MySimpleAgent. dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. + CategoryInfo : InvalidArgument: (:) [Install-TransportAgent], BadImageFormatException

Get-Mailboxpermission for list of Mailboxes

三世轮回 提交于 2019-12-08 01:26:08
问题 I want to get a list of all permissions for a specified list of mailboxes. To get all permissions for just one, I can do this: Get-MailboxPermission -Identity "Mailbox01" What if I wanted to get a list of permissions for more than one mailbox at a time? Something like: Get-MailboxPermission -Identity "Mailbox01","Mailbox02","Mailbox03" How could I do something like that - in one list? 回答1: something like this should work: "Mailbox01","Mailbox02","Mailbox03" | % { Get-MailboxPermission

how to invoke the powershell command with “format-list” and “out-file” pipeline from c#?

混江龙づ霸主 提交于 2019-12-07 20:50:32
问题 Hi I'm working on a C# program to call exchange 2010 powershell cmdlets in remote runspace. The ps command is: "Get-MailboxDatabase -Server EX2010SVR1 -Status | Format-List Identity,Guid,mounted,CircularLoggingEnabled,Recovery | Out-File 'C:\db.txt' -Encoding UTF8 -Width 8192". My code is similar to: static int Main(string[] args) { const string SHELL_URI = "http://schemas.microsoft.com/powershell/Microsoft.Exchange"; const string COMMAND = "Get-MailboxDatabase -Server EX2010SVR1 -Status |

How to get the Item ID of a mail item in Exchange 2010

一世执手 提交于 2019-12-06 14:29:24
问题 I am using Exchaneg Web Services in c# to retrieve all the emails from a mailbox on Exchange 2010. I am putting all the information for each email in a data table that is returned to the calling function. I also need the unique Item ID of each email so that after I am finished I can mark the email as Read on the Exchange box. I have tried this: // As a best practice, limit the properties returned to only those that are required. PropertySet propSet = new PropertySet(BasePropertySet.IdOnly,

Get-Mailboxpermission for list of Mailboxes

こ雲淡風輕ζ 提交于 2019-12-06 07:38:38
I want to get a list of all permissions for a specified list of mailboxes. To get all permissions for just one, I can do this: Get-MailboxPermission -Identity "Mailbox01" What if I wanted to get a list of permissions for more than one mailbox at a time? Something like: Get-MailboxPermission -Identity "Mailbox01","Mailbox02","Mailbox03" How could I do something like that - in one list? something like this should work: "Mailbox01","Mailbox02","Mailbox03" | % { Get-MailboxPermission -Identity $_ } Have to use a foreach because Get-MailboxPermission doesn't accept [string[]] as pipeline input or

how to invoke the powershell command with “format-list” and “out-file” pipeline from c#?

霸气de小男生 提交于 2019-12-06 05:48:51
Hi I'm working on a C# program to call exchange 2010 powershell cmdlets in remote runspace. The ps command is: "Get-MailboxDatabase -Server EX2010SVR1 -Status | Format-List Identity,Guid,mounted,CircularLoggingEnabled,Recovery | Out-File 'C:\db.txt' -Encoding UTF8 -Width 8192". My code is similar to: static int Main(string[] args) { const string SHELL_URI = "http://schemas.microsoft.com/powershell/Microsoft.Exchange"; const string COMMAND = "Get-MailboxDatabase -Server EX2010SVR1 -Status | Format-List Identity,Guid,mounted,CircularLoggingEnabled,Recovery | Out-File 'C:\db.txt' -Encoding UTF8

Check exchange credentials remotely and check user logged in

别等时光非礼了梦想. 提交于 2019-12-06 03:05:44
问题 I have attempted this with not much success. Basically I need to login to Exchange using EWS remotely. The issue is I don't know if the user has logged in OK or if the credentials are wrong as I get nothing back! If I provide wrong credentials the software just carries on! Is there something I'm missing, I've checked the MSDN stuff about EWS which shows you how to connect to exchange but nothing about validating credentials! Below is the code I currently have to connect. public void connect

How to get the Item ID of a mail item in Exchange 2010

為{幸葍}努か 提交于 2019-12-04 20:25:54
I am using Exchaneg Web Services in c# to retrieve all the emails from a mailbox on Exchange 2010. I am putting all the information for each email in a data table that is returned to the calling function. I also need the unique Item ID of each email so that after I am finished I can mark the email as Read on the Exchange box. I have tried this: // As a best practice, limit the properties returned to only those that are required. PropertySet propSet = new PropertySet(BasePropertySet.IdOnly, ItemSchema.Subject); // Bind to the existing item by using the ItemId. // This method call results in a

Cannot load Exchange powershell snap-in: The type initializer for 'Microsoft.Exchange.Data.Directory.Globals' threw an exception

笑着哭i 提交于 2019-12-04 17:36:58
问题 I have the following code that creates a PowerShell runspace with the Exchange 2010 snap in loaded. Dim runspaceConfig = RunspaceConfiguration.Create() Dim snapInException As PSSnapInException = Nothing runspaceConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.E2010", snapInException) Dim runspace = RunspaceFactory.CreateRunspace(runspaceConfig) runspace.Open() Since installing Visual Studio 2012 I started getting the following error when executing the line that adds the snap-in to