Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My environment is Windows Server2008R2(EN) + SQLServer2005(EN) + SCCM2007 SP1(EN).

I use a windows service program to query SMS_Collection for all collections in SCCM. It works fine. But after i change the display language to Deutsch, the query result is empty.

After i change the display language i also change the copy settings for current user and the non-unicode display language options.

following is the code I use to query the result.

public List<string> GetAllCollections()
       {
           try
           {
               List<string> collectionList = new List<string>();
               IResultObject query = SCCMConnection.Current.QueryProcessor.ExecuteQuery("select * from SMS_Collection");
               foreach (IResultObject o in query)
               {
                   collectionList.Add(o["Name"].StringValue);
                   o.Dispose();
               }
               return collectionList;
           }
           catch (SmsException)
           {
               throw;
           }
       }

   public class SCCMConnection
   {
       private static WqlConnectionManager conMgr;
       public static WqlConnectionManager Current
       {
           get
           {
               if (conMgr != null)
                   return conMgr;
               SCCMConnection sccmCon = new SCCMConnection();
               conMgr = sccmCon.Connect(Dns.GetHostName(), null, null);
               return conMgr;
           }
       }
       public WqlConnectionManager Connect(string serverName, string userName, string userPassword)
       {
           try
           {
               SmsNamedValuesDictionary namedValues = new SmsNamedValuesDictionary();
               WqlConnectionManager connection = new WqlConnectionManager(namedValues);

               if (Dns.GetHostName().Equals(serverName, StringComparison.CurrentCultureIgnoreCase))
               {
                   // Connect to local computer.
                   connection.Connect(serverName);
               }
               else
               {
                   // Connect to remote computer.
                   connection.Connect(serverName, userName, userPassword);
               }
               return connection;
           }
           catch (SmsException e)
           {
               return null;
           }
           catch (UnauthorizedAccessException e)
           {
               return null;
           }
       }
   }



Is there anything else i also need to change, after i change the display language?

I test my service under Chinese,Japanese and Italian,it works fine. But it also doesn't work under French. I don't know why.

Please help...
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900