script error on IADSuser interface 
Author Message
 script error on IADSuser interface

I have a problem running this script, i do not know as to what is the
problem.

Problem:  To determine  on an NT domain if an NT account is locked or not.

My solution:

Dim obj as IADsUser
Dim username as String
Dim domain as String

domain = "domname"
username = "usrname"

Set obj = GetObject("WinNT://" + domain + "/" + username + ",user")

Dim lockvalue as Boolean

lockvalue  = obj.IsAccountLocked

Debug.Print lockvalue

Error i am getting:  Line1 char 9 expectedend of statement, ms VBScript
compilation error and errrorcode 800A0401.

my  environment: I am running off this  a win2k  pro station. The domain
controller i will be seeking info from is a win nt 4.0, however i tried
using my local station name and username, and  is giving me  the same error

request help or a different implementation

Thanks



Thu, 18 Aug 2005 05:30:43 GMT  
 script error on IADSuser interface

Quote:

>I have a problem running this script, i do not know as to
what is the
>problem.

>Problem:  To determine  on an NT domain if an NT account
is locked or not.

>My solution:

>Dim obj as IADsUser
>Dim username as String
>Dim domain as String

>domain = "domname"
>username = "usrname"

>Set obj = GetObject("WinNT://" + domain + "/" + username
+ ",user")

>Dim lockvalue as Boolean

>lockvalue  = obj.IsAccountLocked

>Debug.Print lockvalue

>Error i am getting:  Line1 char 9 expectedend of

statement, ms vbscript
Quote:
>compilation error and errrorcode 800A0401.

>my  environment: I am running off this  a win2k  pro
station. The domain
>controller i will be seeking info from is a win nt 4.0,
however i tried
>using my local station name and username, and  is giving
me  the same error

>request help or a different implementation

>Thanks

Hi,

The code you posted is VB. It will work as VBScript,
except that VBScript does not allow you to type variables.
That is, you cannot declare a variable as type "String",
for example. Your code should work if you remove all the
type information. I believe only the 4 lines below need
modification:

Dim obj
Dim username
Dim domain
Dim lockvalue

Richard



Thu, 18 Aug 2005 06:11:42 GMT  
 script error on IADSuser interface
Plus you will need an alternative to Debug.Print such as WScript.echo.

Joe

Quote:

> >I have a problem running this script, i do not know as to
> what is the
> >problem.

> >Problem:  To determine  on an NT domain if an NT account
> is locked or not.

> >My solution:

> >Dim obj as IADsUser
> >Dim username as String
> >Dim domain as String

> >domain = "domname"
> >username = "usrname"

> >Set obj = GetObject("WinNT://" + domain + "/" + username
> + ",user")

> >Dim lockvalue as Boolean

> >lockvalue  = obj.IsAccountLocked

> >Debug.Print lockvalue

> >Error i am getting:  Line1 char 9 expectedend of
> statement, ms vbscript
> >compilation error and errrorcode 800A0401.

> >my  environment: I am running off this  a win2k  pro
> station. The domain
> >controller i will be seeking info from is a win nt 4.0,
> however i tried
> >using my local station name and username, and  is giving
> me  the same error

> >request help or a different implementation

> >Thanks

> Hi,

> The code you posted is VB. It will work as VBScript,
> except that VBScript does not allow you to type variables.
> That is, you cannot declare a variable as type "String",
> for example. Your code should work if you remove all the
> type information. I believe only the 4 lines below need
> modification:

> Dim obj
> Dim username
> Dim domain
> Dim lockvalue

> Richard



Thu, 18 Aug 2005 16:59:21 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. IADsUser::ChangePassword()

2. Type 'IADsUser' is not defined

3. iadsuser vs iads (contact)

4. ADSI- IADsUser

5. Auomation error: Interface not registered

6. Script Error Or No Script Error That Is The Question

7. Scripting and objects with multiple interfaces

8. Scripting and objects with multiple interfaces

9. HTML interface for WSH scripts on win98?

10. Script interface to C

11. Add a Ras Interface with script

12. Scripting and ActiveX custom interfaces (or IDispatch)??

 

 
Powered by phpBB® Forum Software