locked
Can we connect remotely to OCS server WMI ?? RRS feed

  • Question

  •  

    Dear all,

    can we connect remotely to OCS server 2007 WMI ??

     

    suchas this

     

    public static void Do(string serverIP)

    {

    ManagementScope scope = new ManagementScope(@"\\ServerIP\root\cimv2");

    scope.Connect();

    {

    ObjectQuery query == new ObjectQuery("SELECT * FROM MSFT_SIPESUserSetting");

    ManagementObjectSearcher searcher1 = new ManagementObjectSearcher(scope, query);

    foreach (ManagementObject queryObj in searcher1.Get())

    {

    MessageBox.Show("Address: " + queryObj["Address"]);

    //MessageBox.Show("Authoritative: " + queryObj["Authoritative"]);

    //MessageBox.Show("DefaultDomain: " + queryObj["DefaultDomain"]);

    //MessageBox.Show("InstanceID: " + queryObj["InstanceID"]);

    }

    }

    catch (ManagementException e)

    {

    MessageBox.Show("ManagementException: \n" + e.Message + "\n" + e.ErrorCode.ToString());

    }

    catch (COMException e)

    {

    MessageBox.Show("COMException: \n" + e.Message + "\n" + e.ErrorCode.ToString());

    }

    catch (UnauthorizedAccessException e)

    {

    MessageBox.Show("UnauthorizedAccessException: \n" + e.Message);

    }

    catch (Exception e)

    {

    MessageBox.Show("Exception: \n" + e.Message + "\n" + e.GetType().FullName);

    }

    }

    Monday, November 26, 2007 12:32 PM