Error reading AD subnets

Alw1n
Alw1n used Ask the Experts™
on
Hi,
I have attached a portion of a vb script that I am using, it works fine on two of the domains I have run it on (ie. strSiteObjectDN gets populated with the DN for ech subnet). I am having trouble with a third domain however, the script returns the error 'propert cannot be found in the cache' for the last line (implying that it is not happy about the 'siteObject' property.
Any ideas why this would be so?
strSubnetsContainer = "LDAP://cn=Subnets,cn=Sites," & strConfigurationNC
Set objSubnetsContainer = GetObject(strSubnetsContainer)
objSubnetsContainer.Filter = Array("subnet")
 
For Each objSubnet In objSubnetsContainer
    objSubnet.GetInfoEx Array("siteObject"), 0
    strSiteObjectDN = objSubnet.Get("siteObject")

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
bluntTonyHead of ICT
Top Expert 2009

Commented:
Hi there,
Strange that it would work on two domains, but not one as the config NC is common throughout the forest. If it's not working from one domain this may suggest a replication issue or inconsistency on the DC you're querying with the script.
From the problem domain, use ADSIEdit the browse to the subnets container - are all the subnet objects there, present and correct? Do this for each DC in the domain.
Also from looking at your code, strSiteObjectDN will return the DN of the site object the subnet is associated to, not the DN of the subnet object.
You could also place an echo command at the start of each loop to echo the DN of the subnet object you're looking at, so you can see when it's throwing the error.
Tony

Author

Commented:
Thanks Tony, your info was very helpful. It seems that it is just one of the subnets on the problem domain that has an issue with the 'siteObject' attribute.
Do you think it Is possible to have a subnet that has no site (it doesn't seem possible to create this scenario from the AD sites and subnets msc)?
Head of ICT
Top Expert 2009
Commented:
Are these domains in three seperate forests, or the same forest?
If the same forest (which I assumed), then all three domains would be looking at the same data (or at least they should be).
If three seperate forests, then they will all be looking at their own config NC.
If you create a site, then a subnet, and associate that subnet with the site, if you then delete that site, the subnet object will remain with no data in 'siteObject'. Using the Get method will result in an error if no data is found, whereas if you reference the property like:
objSubnet.siteObject
...then this will not error, but return a NULL value.
So yes, it is possible to have a subnet with no site, but if these domains are in the same forest then I don't think this would be the problem. I would recommend browsing to the subnet object in ADSIEdit, and view it's properties - you can see if there is in fact any data there.
Tony
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
My apologies, I should have mentioned that the three domains are in completely independent environments.
I am sure that there is a 'stray' subnet that is causing the issue on the problem domain, I have tweaked my script and am awaiting results to confirm.
bluntTonyHead of ICT
Top Expert 2009

Commented:
Any news on this Alw1n?

Author

Commented:
Believe it or not, I actually only got the results back today!
It seems that there are subnets without sites on the problem domain, I adjusted my script to deal with this and it's all A-Ok, thanks for the input

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial