c# - How to get Exchange 2010 database size -


i'm trying smallest exchange database in exchange 2010 server using remote session.

i connect exchange server , database properties. of them value, properties databasesize null value.

did body able database size value? part of code below:

static void main(string[] args)     {         string exchangepowershellrpsuri = "http://my.domain/powershell?serializationlevel=full";          pscredential credentials = (pscredential)null;         //provides connection information needed connect remote runspace         // prepare connection                    wsmanconnectioninfo conninfo = new wsmanconnectioninfo((new uri(exchangepowershellrpsuri)),             "http://schemas.microsoft.com/powershell/microsoft.exchange", credentials);         conninfo.authenticationmechanism = authenticationmechanism.kerberos;          conninfo.skipcacheck = true;         conninfo.skipcncheck = true;         conninfo.skiprevocationcheck = true;          // create runspace command executed                    runspace runspace = runspacefactory.createrunspace(conninfo);          // add command runspace's pipeline                        runspace.open();              //represents base functionality of pipeline can used invoke commands             pipeline pipeline = runspace.createpipeline();              command getmdb = new command("get-mailboxdatabase");             getmdb.parameters.add("identity", "*");             getmdb.parameters.add("status", null);              pipeline.commands.add(getmdb);              collection<psobject> select = pipeline.invoke();           if (select.count > 0)         {               foreach(psobject obj in select)             {                 var db = obj.properties["databasesize"].value;                 string name = obj.properties["name"].value.tostring();                 console.writeline("database name: {0} size: {1}", name, db);             }          }          else         {              console.writeline("failed create email account");         }         runspace.dispose();          console.readline();          } 

i have found solution in getmdb.parameters.add need status parameter change value "null" "true"

getmdb.parameters.add("status", null); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -