Exchange 2010 SP1托管/ powershell /不显示所有命令

问题描述:

嗨,,

我已经安装了Exchange 2010 SP1 /主机设置,我现在正尝试在C#中构建一些简单的配置,例如,创建组织。

I have a Exchange 2010 SP1 /hosting setup in place and I'm now trying to build some simple provisioning in C# to, for example, create an organization.

 

  string str_password = "#######";
  string username = "Administrator@contoso.com";
  SecureString password = new SecureString();

  string liveIdconnectionUri = "http://e2010-cashub01/Powershell?serializationLevel=Full";

  foreach (char x in str_password)
  {
   password.AppendChar(x);
  }

  PSCredential credential = new PSCredential(username, password);

  // Set the connection Info
  WSManConnectionInfo connectionInfo = new WSManConnectionInfo((new Uri(liveIdconnectionUri)), "http://schemas.microsoft.com/powershell/Microsoft.Exchange",
  credential);

  connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;

  Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(connectionInfo);
  RunspaceConfiguration runspaceConf = RunspaceConfiguration.Create();

  PowerShell powershell = PowerShell.Create();
  PSCommand command = new PSCommand();

  command.AddCommand("get-command");

 

这段代码工作正常,我看到了可用的命令:

This piece of code works fine, I see the commands available to me:

 


Exit-PSSession
Get-Command
Get-FormatData
Get-Help
Get-Mailbox
Get-MailboxExportRequest
Get-MailboxExportRequestStatistics
Get-MailboxImportRequest
Get-MailboxImportRequestStatistics
Measure-Object
New-MailboxExportRequest
New-MailboxImportRequest
Out-Default
Remove-MailboxExportRequest
Remove-MailboxImportRequest
Resume-MailboxExportRequest
Resume-MailboxImportRequest
Search-Mailbox
Select-Object
Set-ADServerSettings
Set-MailboxExportRequest
Set-MailboxImportRequest
Suspend-MailboxExportRequest
Suspend-MailboxImportRequest
Write-AdminAuditLog

制作确定以下交换pssnapin

Make sure following exchange pssnapin loaded

Get- PSSnapin -Registered

Get-PSSnapin -Registered

" Microsoft.Exchange.Management.PowerShell.E2010"

"Microsoft.Exchange.Management.PowerShell.E2010"

如果没有将pssnapin添加到会话中

if not add pssnapin to the session

Add-PSSnapin ""Microsoft.Exchange.Management.PowerShell.E2010""

Add-PSSnapin "Microsoft.Exchange.Management.PowerShell.E2010"

Exchange 2010中没有create-mailbox命令,它的启用邮箱。

There is no create-mailbox command in exchange 2010, its Enable-Mailbox.

尝试搜索命令的动词或名词以找到确切的交换powershell命令

try searching verb or noun of command to find the exact exchange powershell command

Get-Command -noun * mailbox * | fl name

Get-Command -noun *mailbox* | fl name

Get-Command -verb * add * | fl name

Get-Command -verb *add* | fl name