• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1055
  • Last Modified:

Where can I download ADSI?

Where can I download ADSI?
0
Abdu_Allah
Asked:
Abdu_Allah
  • 11
  • 11
  • +1
1 Solution
 
Mike KlineCommented:
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
 
Abdu_AllahAuthor Commented:
I'm talking about Active Directory Services Interface.
0
 
iamshakedCommented:
http://technet.microsoft.com/en-us/library/cc749949.aspx

down at the bottom where it says
To Install ADSI
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
Chris DentPowerShell DeveloperCommented:

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
 
Abdu_AllahAuthor Commented:
The download link does not work , it takes me to http://www.microsoft.com/windows/
0
 
Abdu_AllahAuthor Commented:
>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
 
Chris DentPowerShell DeveloperCommented:

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
 
Abdu_AllahAuthor Commented:
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
 
Chris DentPowerShell DeveloperCommented:

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
 
Abdu_AllahAuthor Commented:
I'm getting error number -2147221005 , per this website http://www.stylusstudio.com/xsllist/200008/post31110.html
It means Invalid class string.
0
 
Chris DentPowerShell DeveloperCommented:

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
 
Abdu_AllahAuthor Commented:
By the way this script is in .NET page so there is no place for "Set" command.
0
 
Chris DentPowerShell DeveloperCommented:

"_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
 
Chris DentPowerShell DeveloperCommented:

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
 
Abdu_AllahAuthor Commented:
it's server side script, so what's the problem with it?!
0
 
Chris DentPowerShell DeveloperCommented:

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
 
Abdu_AllahAuthor Commented:
>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
 
Chris DentPowerShell DeveloperCommented:

Is line 1 this in yours?

Dim dso = GetObject("WinNT:")

Chris
0
 
Abdu_AllahAuthor Commented:
sorry the problem is on line # 2
Dim lobjUser = dso.OpenDSObject("WinNT://" & domain, domainAndUsername, pwd, 1)
 
0
 
Chris DentPowerShell DeveloperCommented:

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
 
Abdu_AllahAuthor Commented:
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
 
Chris DentPowerShell DeveloperCommented:

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

Chris
0
 
Abdu_AllahAuthor Commented:
>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
 
Chris DentPowerShell DeveloperCommented:

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

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

  • 11
  • 11
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now