Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Cannot retrieved DatabaseSize value Get-MailboxDatabase with C#, remote Powershell.

$
0
0

Hi all,

I have a client(runing a service) & a server (containt MailExchange server 2010).

Currently, I use remote powershell to send command from client to server via C#.

I can create a new mailbox, disable mailbox & also create distribution group.

But i can get DB size of a specify DB Name.

And this is my code :

string cmd = "Get-MailboxDatabase -Identity " + dbName; Collection<PSObject> rs; Pipeline pipeline = null; Collection<PSObject> rs = new Collection<PSObject>(); using (runSpace = RunspaceFactory.CreateRunspace(conn)) { if (runSpace.RunspaceStateInfo.State.ToString() == "BeforeOpen") { runSpace.Open(); pipeline = runSpace.CreatePipeline(); pipeline.Commands.AddScript(cmd); } rs = pipeline.Invoke(); } if (rs != null && rs.Count > 0) { String dbSize = rs[0].Properties["DatabaseSize"].Value ; }

I can get many values in rs[0] variable .

Ex : Name, Server ... but i can't get DatabaseSize.

dbSize allway is null :(.

Please help me!

Phung Le.




Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>