I would like to translate this into vb.net. Trying to leanr how to use the wmi .net [login to view URL] providore. But i am haveing a hard time finding vb.net examples. using System; using [login to view URL]; using [login to view URL]; using [login to view URL]; using [login to view URL]; using [login to view URL]; using [login to view URL]; using [login to view URL]; using [login to view URL]; namespace MyIis6ControlNamespace { public class MyIis6ControlObject : WebService { // standard VS-generated code deleted for clarity [WebMethod] [SoapRpcMethod] public string start(string serverComment) { ManagementScope scope = new ManagementScope("root\\MicrosoftIISv2"); try { [login to view URL](); ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, new ObjectQuery( "select Name from IIsWebServerSetting where ServerComment=\"" + serverComment + """)); ManagementObjectCollection coll = [login to view URL](); [login to view URL] enumerator = [login to view URL](); [login to view URL](); ManagementBaseObject cur = [login to view URL]; string serverName = (string) [login to view URL]["Name"].Value; ManagementObject iisSite = new ManagementObject( scope,new ManagementPath("IIsWebServer='"+serverName+"'"),null); [login to view URL]("start",new object[0]); return "Started"; } catch (Exception e) { return "Failed to connect: " + [login to view URL]; } } // stop is just like start except that the name of the method to invoke is "stop" private static string [] states = {"","starting","started","stopping", "stopped","pausing","paused","continuing"};
## Deliverables
[WebMethod] [SoapRpcMethod] public string state(string serverComment) { ManagementScope scope = new ManagementScope("root\\MicrosoftIISv2"); try { [login to view URL](); ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, new ObjectQuery( "select Name from IIsWebServerSetting where ServerComment=\"" + serverComment + """)); ManagementObjectCollection coll = [login to view URL](); [login to view URL] enumerator = [login to view URL](); [login to view URL](); ManagementBaseObject cur = [login to view URL]; string serverName = (string) [login to view URL]["Name"].Value; ManagementObject iisSite = new ManagementObject( scope,new ManagementPath("IIsWebServer='"+serverName+"'"),null); return states[(int)[login to view URL]("ServerState")]; } catch (Exception e) { return("Failed to connect: " + [login to view URL]); } } } } This code in vb.net working.
## Platform
windows 2000-2003 server iis6