locked
Newbie help? Where to start with SDK... RRS feed

  • Question

  • I'm having troubles figuring out where to start with my application.

     

    Essentially, I need to report on a few things within OCS. 

     

    My first goal: get all the server names and their roles from within the pool (or the standard edition server name if not enterprise/seperated).

     

    Second goal: see what users have archiving enabled

     

    Third goal: do other things along these lines...just report on the environment.

     

    I know there are WMI access classes in one of the SDK's, but I have no idea on how to go about setting up a project or using those classes within a project.

     

    My question is: which SDK do I use, and does anyone have some sample code for importing the libary into visual studio 2005, using C++? 

     

    ANY help is greatly appreciate!!

     

    Thanks

    J

    Friday, October 5, 2007 7:03 PM

Answers

  •  

    I talked to support and got a very clear answer.

     

    1) WMI queries must be executed on a server that has the OCS admin pack installed

    2) the WMI connection must be made to the local computer.  don't connect to the OCS server, because it will then have to hop to the DC, and the double hop fails (can't carry the credentials on the next hop).

    3) because of 2), you can only query information from within the current domain

     

    Hope this helps someone else.

     

    Cheers

    Monday, October 22, 2007 7:17 PM

All replies

  •  Ok, I have a WMI app that can retrieve different sets of information from the OCS pool...but here's a new problem:

     

    I can't run this from any computer BUT the front-end server.  On all other servers, it fails.  I can change the WMI query to select the computer name, and it returns just fine...but anything within the OCS data set, it returns no records (doesn't fail, just returns nothing).

     

    To be clear:

    1) I can run this query on the front-end and it works

    2) The front-end has the management utilities installed

    3) I can run all non-ocs WMI queries against the front-end server from any other server (using same credentials--domain admin)

    4) the query ONLY works on the front-end server

     

    Again, any help is appreciated.

     

    Cheers,

    J

    Friday, October 12, 2007 7:24 PM
  •  

    I talked to support and got a very clear answer.

     

    1) WMI queries must be executed on a server that has the OCS admin pack installed

    2) the WMI connection must be made to the local computer.  don't connect to the OCS server, because it will then have to hop to the DC, and the double hop fails (can't carry the credentials on the next hop).

    3) because of 2), you can only query information from within the current domain

     

    Hope this helps someone else.

     

    Cheers

    Monday, October 22, 2007 7:17 PM
  • but i try to connect to OCS server 2005 WMI remotely and successed with this code for example

    public static void Do(string serverIP)

    {

    ManagementScope scope = new ManagementScope(@"\\196.2.194.17\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"]);

    }

    }

     

    but i have a problem with the same code if i try it on OCS server 2007 WMI and get me the following Exception

     

    COMException , ErrorCode : -2147016672

    Is there any problem to use OCS 2007 WMI  ??

     

    can u help me ??

     

    and understand how can WMI queries must be executed on a server that has the OCS admin pack installed although i successed to do that ?

    Monday, November 26, 2007 3:29 PM
  • The underlying problem isn't that connecting remotely doesn't work...it's that it won't ALWAYS work (and it's not supported by Microsoft).

     

    In some scenarios, you can connect to a remote machine, have it then hop to active directory, and successfully retreive the information for you.  But, this will definitely not ALWAYS work.  That's why it's best to connect to the local machine to query WMI.  And, for any of the OCS classes, you will need the admin pack installed.

     

    One thing to keep in mind: If you use the IP address like that (\\ip address\root\cimv2) when connecting to your local machine, instead of ("root\cimv2"), then you still may run in to the credential hop problem.  Because WMI thinks you're connecting to a remote computer, it then has to carry your credentials from the connection, to active directory, and you will then run in to the general "An Operations Error Occurred" problem. 

     

    So, in short:

    1) Connect locally for all queries (in most cases).

    2) Make sure the admin pack is installed locally. 

    3) Make sure the class you want to access is available at the domain level.  If it isn't, only THEN do you connect to a specific machine to get the desired OCS WMI class.  See the following link for reference.  It describes what classes are available at the domain level (MSFT_SIPEsUserSetting is at the domain level), and what classes are only on specific servers:

     

    Microsoft Office Communications Server 2007 Server SDK
    WMI Class Management Scopes and Roles
     
     
    Monday, November 26, 2007 3:55 PM
  • Please what's  << the credential hop problem >> ??

     

    Monday, November 26, 2007 6:50 PM
  • The quick way to explain it: you cannot open a connection to another computer, and have that computer connect you to another data source.

     

    It works with some products and some scenarios, but not in this case.

     

    If you connect to the OCS server with WMI, and then ask for a domain level object, your connection then "hops" to the domain controller (or active directory, I should say).  But, while hopping, it can't carry the security information with it, so the log in at the next hop fails ("An operations error occurred").

     

    This is why you need to connect locally, instead of to the OCS server itself.  When you connect locally, and ask for information, it queries active directory (or SQL, depending on where the information resides) and only has to hop ONCE (straight to the information), and can use your current credentials without issue.

     

    I can't fully explain it in great technical detail, but there are many articles out there that can answer your questions a lot better than me Smile

     

    I hope this helps...if it doesn't, feel free to correct me where I'm wrong!

     

    Monday, November 26, 2007 7:02 PM
  • Thnx very much for ur help

     

    and i like to announce all of you that there is a Free Tool lanched at www.ocscm.com for manage Office Communications Server 2007 Users contaclt list in easy and effieciencly way fro IT Administartors  in any orgainzations

     

    Tuesday, December 18, 2007 12:33 AM
  • Double hop issue can be resolved if login credentials (domain name, user name and password) are explicitly specified during the connection.

     

    Vivek Garg

    http://imwire.eventure.biz

    Wednesday, December 19, 2007 11:40 AM
  • Specifying credentials: I had tried this quite a few times, and just tried it now using wbemtest, and I still get the same error. 

     

    I tried it through code as well to no avail.

     

    Wednesday, December 19, 2007 2:50 PM
  •  

    This absolutly was the source of all of our problems.  Myself and another person have been looking at this for 4 hours.  You are the champ.

    I Dub you the champ.

     

    Thanks,

    Saturday, August 16, 2008 12:54 AM
  •  Jim Hume wrote:

    I'm having troubles figuring out where to start with my application.

     

    Essentially, I need to report on a few things within OCS. 

     

    My first goal: get all the server names and their roles from within the pool (or the standard edition server name if not enterprise/seperated).

     

    Second goal: see what users have archiving enabled

     

    Third goal: do other things along these lines...just report on the environment.

     

    I know there are WMI access classes in one of the SDK's, but I have no idea on how to go about setting up a project or using those classes within a project.

     

    My question is: which SDK do I use, and does anyone have some sample code for importing the libary into visual studio 2005, using C++? 

     

    ANY help is greatly appreciate!!

     

    Thanks

    J

    Monday, August 25, 2008 7:48 PM