-1

I am trying to execute the Powershell command:

Stop-BrokerSession 2904

That number, 2904, definitely shows up in the results as seen in the code below. I used MessageBox.Show to verify the right number for the session id. However, for some reason I get this binding error. I can type that command in at the powershell prompt and it works fine, but when trying to execute it here I get this binding exception. What's the deal?

enter image description here

My guess as to what is wrong is that this parameter doesn't have a name. It's just a number. You put the command and the session id next to it but there isn't a name for it, it's not like "Stop-BrokerSession -SessionId 2904" it's just "Stop-BrokerSession 2904" and that I think is the issue.

Also this doesn't work:

logoff.parameters.Add(null, x.Properties["Uid"].Value.ToString());
abatishchev
  • 98,240
  • 88
  • 296
  • 433
Nathan McKaskle
  • 2,926
  • 12
  • 55
  • 93

1 Answers1

0

Have you tried

x.Properties["Uid"].Value

without ToString()? As I see the value must be of Int64 type.

Mikhail Tumashenko
  • 1,683
  • 2
  • 21
  • 28