Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

ManagementObjectSearcher (WMI) ignores metabase keys with ..

 
   Web Hosting Problem Solving Community! (Home) -> IIS RSS
Next:  User needs administrative priveliges to run IIS m..  
Author Message
nospam235

External


Since: Nov 22, 2004
Posts: 5



(Msg. 1) Posted: Tue Apr 05, 2005 10:57 am
Post subject: ManagementObjectSearcher (WMI) ignores metabase keys with null parents
Archived from groups: microsoft>public>dotnet>framework>wmi, others (more info?)

I am trying to list all the AppRoots for a given site, using WMI like this:

System.Collections.ArrayList alAppRoots = new
System.Collections.ArrayList();
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, new
ObjectQuery ("SELECT * FROM IIsDirectory where Name LIKE 'W3SVC/1/ROOT/%'"),
null);

ManagementObjectCollection appRoots = searcher.Get();
foreach(ManagementObject appRoot in appRoots)
{
if(appRoot.Properties["AppRoot"].Value != null)
{
string path = appRoot.Properties["AppRoot"].Value.ToString();
alAppRoots.Add(path);
}
}
return alAppRoots.ToArray(typeof(string)) as string[];


That works just fine, unless one of the AppRoots contains a null parent key.
You can easily create a null parent key using inetmgr. Say you have this
structure: /foo/bar/baz where /foo and /foo/bar have no corresponding
metbase keys. Create an AppRoot at /foo/bar/baz using inetmgr. The metabase
now shows /LM/W3SVC/1/Root/foo/bar/baz as an AppRoot, but also creates null
keys for /foo and /foo/bar in the process. WMI ignores /foo/bar/baz in the
above query.

Is this a WMI bug, or can I work around this?

--
Mark A. Richman

 >> Stay informed about: ManagementObjectSearcher (WMI) ignores metabase keys with .. 
Back to top
Login to vote
Peter Falz

External


Since: Apr 06, 2005
Posts: 1



(Msg. 2) Posted: Tue Apr 05, 2005 7:35 pm
Post subject: Re: ManagementObjectSearcher (WMI) ignores metabase keys with null parents [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Mark,

"Mark A. Richman" <nospam.TakeThisOut@nospam.com> schrieb im Newsbeitrag news:%232%23IsCfOFHA.3292@TK2MSFTNGP12.phx.gbl...
 > ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, new
 > ObjectQuery ("SELECT * FROM IIsDirectory where Name LIKE 'W3SVC/1/ROOT/%'"),
 > null);
as i used the following WQL-Command with WMITools (CIM Studio) i also get
the instance in the enumeration where the property "AppRoot" is "<empty>" (NULL):

SELECT * FROM IIsDirectory where Name LIKE 'W3SVC/%/ROOT%'


 > That works just fine, unless one of the AppRoots contains a null parent key.
 > You can easily create a null parent key using inetmgr. Say you have this
 > structure: /foo/bar/baz where /foo and /foo/bar have no corresponding
 > metbase keys. Create an AppRoot at /foo/bar/baz using inetmgr. The metabase
 > now shows /LM/W3SVC/1/Root/foo/bar/baz as an AppRoot, but also creates null
 > keys for /foo and /foo/bar in the process. WMI ignores /foo/bar/baz in the
 > above query.
 > Is this a WMI bug, or can I work around this?
It exists no BUGs, that are all features. Wink

Bye
Peter<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: ManagementObjectSearcher (WMI) ignores metabase keys with .. 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting Problem Solving Community! (Home) -> IIS All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]