Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Use VBcript to List Office Users form Active Directory
I have written vbscript to display a list of users from a particler office filtered
by the Office attribute and it is erroring outwith the message below, what is wromg
with thescript below?
15, 2) Microsoft VBScript runtime error: Object doesn't
support this property or method: 'objItem.physicalDeliveryO
'On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("S
ELECT * FROM Win32_UserAccount",,48)
For Each objItem In colItems
ficeName = "BS" Then
Wscript.Echo objItem.Name + ", " + objItem.FullName
8/22/2022 - Mon
You will get that error when the entry you're reporting doesn't contain the field you're trying to display. ( ie the field is empty(null) and didn't return with the results)
It says clearly Object doesn't support this property or method: 'objItem.physicalDeliveryO
All the records in our AD are NOT null. Could this be the wrong direction?
Perhaps a mis-communication?
What I mean is that for the referenced objItem, User1 let say, has no physicalDeliveryOfficeName
assigned. If you go look for User1 in Active directory you'll see that the field for physicalDeliveryOfficeName
Therefore you'll have an object for User1, but no address.
Your help has saved me hundreds of hours of internet surfing.
Ok how do I fix this code?
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
You are right I need to absolutely access the physicalDeliveryOfficeName
attribute so I need to query LDAP. Thanks for the tip it was just staring me in the face.
Not the complete solution
to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent