Click here to Skip to main content
15,886,873 members

Comments by MitchG92_24 (Top 23 by date)

MitchG92_24 1-May-13 4:12am View    
Solved it - the problem is a really easy but seemingly stupid one.
(@"\\SERVERNAME\root\sms\site_PR1");
This is wrong (in terms of this project) it must be displayed as:
("\\\\SERVERNAME\\root\\sms\\site_PR1");
MitchG92_24 30-Apr-13 11:54am View    
Using wbemtest both of them result in the same correct outcome for me. Just not in the code. It's frustrating that the SDK doesn't document how to add a computer to a particular collection.
MitchG92_24 30-Apr-13 10:47am View    
by the way yje query works fine when run in wbemtest connected to the site detailed in the managementscope here
MitchG92_24 30-Apr-13 10:40am View    
Hi Dave, was wondering if you could lend any more advice?

I have been trawling the internet all day for answers to my problem with no luck.

string query = "SELECT * WHERE SMS_Collection.Name = 'CollectionName'";

//METHOD ONE - DOESNT WORK - Errors with System.NotImplementedException (although it passes the validity test)

bool querybool = connection.IsQueryValid(query);if (querybool == true){

IResultObject iro = connection.QueryProcessor.ExecuteQuery(query);}

//METHOD 2 - DOESNT WORK - Errors with "INVALID QUERY"

WqlObjectQuery wqlQuery = new WqlObjectQuery(query);

ManagementScope ms = new ManagementScope(@"\\SERVERNAME\root\sms\site_PR1");

ManagementObjectSearcher searcher = new ManagementObjectSearcher(ms,wqlQuery);

ManagementObjectCollection moc = searcher.Get();


Do you have any ideas as to why these methods dont work?
MitchG92_24 30-Apr-13 7:34am View    
ok thank you, i'll get looking into that. You have been a massive help :)