Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Exchange 2010 SP1 hosting /powershell/ not showing all commands

$
0
0

Hi,,

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

 

The funny thing is, that I cannot see commands like create-mailbox, create-organization, etc. I'm probably just missing something here, but I'm stuck. When I start a EMS it works fine. I have all the commands I need to build my provisioning scripts. Anybody any idea?

Any help would be greatly appreciated...



Viewing all articles
Browse latest Browse all 7132

Trending Articles