Solved

Where can I download ADSI?

Posted on 2009-05-12
24
1,046 Views
Last Modified: 2013-11-05
Where can I download ADSI?
0
Comment
Question by:Abdu_Allah
  • 11
  • 11
  • +1
24 Comments
 
LVL 57

Expert Comment

by:Mike Kline
ID: 24367635
are you talking about ADSIEdit?
http://support.microsoft.com/kb/892777
That is part of the support tools.
Another good tool for viewing objects is AD Explorer
http://technet.microsoft.com/en-us/sysinternals/bb963907.aspx
 
Thanks
Mike
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24367830
I'm talking about Active Directory Services Interface.
0
 
LVL 2

Expert Comment

by:iamshaked
ID: 24368064
http://technet.microsoft.com/en-us/library/cc749949.aspx

down at the bottom where it says
To Install ADSI
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24368205

Why do you think you need to download ADSI? Because most systems have it installed. If you're doing a bit of scripting on a Windows machine you certainly don't need to download it.

Chris
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24368226
The download link does not work , it takes me to http://www.microsoft.com/windows/
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24368239
>If you're doing a bit of scripting on a Windows machine you certainly don't need to download it.

I'm doing a scripting on Vista where ADSI is not installed.
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24368531

Yes it is. I use Vista here and can quite happily test code using ADSI.

Would you be able to share your code with us? Perhaps that might indicate why.

Chris
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24368827
What Vista you are using? I'm using Vista Home Premium.
The following is my code:

            Dim dso = GetObject("WinNT:")

            Dim lobjUser = dso.OpenDSObject("WinNT://" & domain, domainAndUsername, pwd, 1)
 

            'WScript.Echo(Err.Number)
 

            If Err.Number = 0 Then

                'WScript.Echo("Authenticated")

                If lobjUser.Homedirectory = "" Then

                    intErr = 2

                    'txtErr = "User does not have home directory, please contact your administrator."

                Else

                    _HomeDirectory = lobjUser.Homedirectory

                End If

            Else

                'Not authenticated

                intErr = 1

                Return False

                ' WScript.Echo("Not Authenticated")

            End If

Open in new window

0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24368889

Ultimate. You know you can't combine Dim and value assignment in a single statement in VbScript? You'll need a Set or two as well.

It would have to be something like the below, where : is just the equivalent of a line break.

What error are you getting returned if that's just a copy / paste based typo?

Chris
            Dim dso : Set dso = GetObject("WinNT:")

            Dim lobjUser : Set lobjUser = dso.OpenDSObject("WinNT://" & domain, domainAndUsername, pwd, 1)

 

            'WScript.Echo(Err.Number)

 

            If Err.Number = 0 Then

                'WScript.Echo("Authenticated")

                If lobjUser.Homedirectory = "" Then

                    intErr = 2

                    'txtErr = "User does not have home directory, please contact your administrator."

                Else

                    _HomeDirectory = lobjUser.Homedirectory

                End If

            Else

                'Not authenticated

                intErr = 1

                Return False

                ' WScript.Echo("Not Authenticated")

            End If

Open in new window

0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24368933
I'm getting error number -2147221005 , per this website http://www.stylusstudio.com/xsllist/200008/post31110.html
It means Invalid class string.
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24368951

On what line? What's the Err.Description value?

Or just kill off any "On Error Resume Next" statements and let it drop the error to the console :)

Chris
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24368952
By the way this script is in .NET page so there is no place for "Set" command.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 70

Expert Comment

by:Chris Dent
ID: 24368993

"_HomeDirectory"

_ is generally reserved, it allows a command to continue over a line. It cannot be used at the beginning of a variable name. That throws an error as well.

Chris
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24369173

I'm so confused now. You said "I'm doing a scripting".

VB .NET certainly can't be run as a client-side script, largely because it isn't a scripting language.

> this script is in .NET page

So is it a client-side script? Or something the server hosting the site is processing?

It's not JavaScript, so VbScript... Makes sense with all those WScript.Echo statements around the place.

Chris
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24372303
it's server side script, so what's the problem with it?!
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24372406

Okay, if I assume it's VB .NET (and not a script at all)...

What values are you passing for "domain"? And which line is producing the error message?

If the variable name is accurate it cannot have a homeDirectory property which would potentially cause an error.

Inclusion of WScript.Echo still confuses me, but there we go.

Chris
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24375284
>On what line? What's the Err.Description value?

Err.Description  is "Unspecified error "
on line # 1
 
Forget WScript as you can see it's comented out, this is result from copy/paste operation.
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24375299

Is line 1 this in yours?

Dim dso = GetObject("WinNT:")

Chris
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24375390
sorry the problem is on line # 2
Dim lobjUser = dso.OpenDSObject("WinNT://" & domain, domainAndUsername, pwd, 1)
 
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24375487

Hard-code values to check it works in principal.

e.g.

Dim lobjUser = dso.OpenDSObject("WinNT://yourdomain", "yourdomain\username", "password", 1)

You will get "Unspecified error" if the value for "yourdomain" is not correct.

Chris
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24403190
Ok I get rid from that error but why I got this error:
"Public member 'Homedirectory' on type '_ComObject' not found."
on line number 8 of your code!
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24403478

What are you passing for "domain"? That value can only exist on a user account.

Chris
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 24412063
>What are you passing for "domain"? That value can only exist on a user account
Not sure if I got your point but I the authentication was successfully done but the problem appear on line 8 of your code.
0
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 24412219

Sure, but you'll only be able to get that value if this is passed for "domain":

domain = "yourdomain/username"
Dim lobjUser = dso.OpenDSObject("WinNT://" & domain, domainAndUsername, pwd, 1)

If domain is just:

domain = "yourdomain"

Then it won't be able to return the HomeDirectory property, it doesn't exist on the domain object, only on the user account object.

The authentication stands separately from this, all that does is give you a connection to "domain" using the credentials supplied. It doesn't implicitly allow you to access anything belonging to domainAndUsername.

Chris
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I'm sure that every Windows systems administrator has written, or at least used, a batch or VBS login script at some point in their career, whether it is to map network drives, install printers, or set some user preferences.  No more! With Window…
Mapping Drives using Group policy preferences Are you still using old scripts to map your network drives if so this article will show you how to get away for old scripts and move toward Group Policy Preference for mapping them. First things f…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now