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

Adding Parameter to Command in to connect Remote powershell thorugh VB.net

$
0
0

Hello All

I am writing a code in VB.net and trying to call Get-MoveRequestStatistics  | ft DisplayName, Status, RemoteDatabaseName, TargetDatabase,TotalMailboxSize,PercentComplete from O365 remote runspace. When i run the code it throws me a error message :

An unhandled exception of type 'System.Management.Automation.RemoteException' occurred in System.Management.Automation.dll

Additional information: A parameter cannot be found that matches parameter name 'DisplayName,Status,PercentComplete'.

I tried changing the code by mentioning only one parameter still no luck. Need suggestion how to pipe the parameters to command in VB.net

Here is my code for reference:

Dim runspace As Runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(MyConnectionInfo.Instance.connectionInfo)
        runspace.Open()
        Dim plPileLine As Pipeline = runspace.CreatePipeline()
        Dim gmGetMove As New Command("Get-MoveRequestStatistics")
        gmGetMove.Parameters.Add("DisplayName")
        gmGetMove.Parameters.Add("Status")
        gmGetMove.Parameters.Add("PercentComplete")
        plPileLine.Commands.Add(gmGetMove)
        'plPileLine.Commands.Add("Out-String")

       Dim RsResultsresults = plPileLine.Invoke()

thanks

Sriram


Thanks Sriram


Viewing all articles
Browse latest Browse all 7132

Trending Articles



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