Exchange 2010 SP1托管/ powershell /不显示所有命令 [英] Exchange 2010 SP1 hosting /powershell/ not showing all commands

查看:73
本文介绍了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





这篇关于Exchange 2010 SP1托管/ powershell /不显示所有命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆