Click here to Skip to main content
15,914,209 members
Home / Discussions / C#
   

C#

 
AnswerRe: Multithreaded remoting in C# [modified] Pin
DaveyM6915-Apr-09 9:45
professionalDaveyM6915-Apr-09 9:45 
Questiongetting a handle to an embedded flash movie inside a webbrowser Pin
jeanbern15-Apr-09 7:00
jeanbern15-Apr-09 7:00 
QuestionCannot connect to SQL Server 2005 Pin
arimao15-Apr-09 6:38
arimao15-Apr-09 6:38 
AnswerRe: Cannot connect to SQL Server 2005 Pin
stonebergftw15-Apr-09 8:54
stonebergftw15-Apr-09 8:54 
GeneralRe: Cannot connect to SQL Server 2005 Pin
arimao15-Apr-09 9:14
arimao15-Apr-09 9:14 
GeneralRe: Cannot connect to SQL Server 2005 Pin
stonebergftw15-Apr-09 10:32
stonebergftw15-Apr-09 10:32 
QuestionHow to Scan Remote PC For UDP Open & Closed Ports? Pin
alparody15-Apr-09 6:34
alparody15-Apr-09 6:34 
QuestionInvoking a WMI method on a Remote Machine Pin
bbranded15-Apr-09 6:05
bbranded15-Apr-09 6:05 
Hello,

I am attempting to invoke the GetVersionVector method of the DfsrReplicatedFolderInfo on a remote machine.

After referring to two articles (1, 2) about the subject on InvokeMethod in C#, I have written the following code:


<br />
string TargetMachine = textBox2.Text;<br />
<br />
<br />
System.Management.ManagementScope oMs = new<br />
<br />
System.Management.ManagementScope("\\\\" + TargetMachine + "\\root\\microsoftdfs");<br />
oMs.Connect();<br />
<br />
System.Management.ObjectQuery oQuery = new System.Management.ObjectQuery("SELECT * FROM DfsrReplicatedFolderInfo"); //WHERE ReplicationGroupName='" + comboBox6.Text + "'");<br />
<br />
ManagementObjectSearcher oSearcher = new<br />
<br />
ManagementObjectSearcher(oMs, oQuery);<br />
<br />
ManagementObjectCollection MgmtObject = oSearcher.Get();<br />
<br />
<br />
foreach (ManagementObject item in MgmtObject)<br />
{<br />
<br />
    //Get an input parameters object for this method<br />
    //ManagementBaseObject inParams = item.GetMethodParameters("GetVersionVector");<br />
<br />
    //Fill in input parameter values<br />
    //inParams["CommandLine"] = "calc.exe";<br />
<br />
    //Execute the method<br />
    ManagementObject outParams = (ManagementObject)item.InvokeMethod("GetVersionVector", null);<br />
<br />
    //Display results<br />
    //Note: The return code of the method is provided in the "returnValue" property of the outParams object<br />
    MessageBox.Show(outParams.ToString());<br />
}<br />



When attempting to InvokeMethod, the following error is thrown:

Object reference not set to an instance of an object.


If I do away with the cast and use declare outParams as an object instead, i get the same error.


Any input is appreciated,

Matt Brown
AnswerRe: Invoking a WMI method on a Remote Machine Pin
bbranded15-Apr-09 8:22
bbranded15-Apr-09 8:22 
Questionsynchronous and asynchronous communication Pin
yesu prakash15-Apr-09 5:52
yesu prakash15-Apr-09 5:52 
AnswerRe: synchronous and asynchronous communication Pin
0x3c015-Apr-09 6:29
0x3c015-Apr-09 6:29 
GeneralRe: synchronous and asynchronous communication Pin
yesu prakash15-Apr-09 18:08
yesu prakash15-Apr-09 18:08 
QuestionProblem in disabling close button(X) of window. Pin
priyamtheone15-Apr-09 5:25
priyamtheone15-Apr-09 5:25 
AnswerRe: Problem in disabling close button(X) of window. [modified] Pin
DaveyM6915-Apr-09 5:31
professionalDaveyM6915-Apr-09 5:31 
AnswerRe: Problem in disabling close button(X) of window. Pin
agent00zelda15-Apr-09 5:32
agent00zelda15-Apr-09 5:32 
GeneralRe: Problem in disabling close button(X) of window. Pin
priyamtheone15-Apr-09 20:16
priyamtheone15-Apr-09 20:16 
AnswerRe: Problem in disabling close button(X) of window. Pin
Luc 64801115-Apr-09 5:40
Luc 64801115-Apr-09 5:40 
AnswerRe: Problem in disabling close button(X) of window. Pin
DaveyM6915-Apr-09 5:43
professionalDaveyM6915-Apr-09 5:43 
AnswerRe: Problem in disabling close button(X) of window. Pin
PIEBALDconsult15-Apr-09 6:03
mvePIEBALDconsult15-Apr-09 6:03 
NewsRe: Problem in disabling close button(X) of window. Pin
priyamtheone15-Apr-09 21:25
priyamtheone15-Apr-09 21:25 
QuestionSIteMap Pin
kibromg15-Apr-09 4:02
kibromg15-Apr-09 4:02 
AnswerRe: SIteMap Pin
hat_master15-Apr-09 6:04
hat_master15-Apr-09 6:04 
GeneralRe: SIteMap Pin
kibromg15-Apr-09 6:36
kibromg15-Apr-09 6:36 
AnswerRe: SIteMap Pin
hat_master15-Apr-09 7:18
hat_master15-Apr-09 7:18 
GeneralRe: SIteMap Pin
kibromg16-Apr-09 0:54
kibromg16-Apr-09 0:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.