setting user rights problem using adsi 
Author Message
 setting user rights problem using adsi

*** following is a part of my script to get a user object using adsi

i always get an error message when trying to set the userflag property. all
documentation says this is the right way. also, i do have the correct
rights. what's wrong?

        dim flag
        flag = &H40

        dim domainName
        domainName = "thinkinc/sfmgloeckle"
        dim userName
        userName = "new"

        dim objUser
        set objUser = GetObject("WinNT://" & domainName & "/" & userName)

        dim oldFlag
        oldFlag = objUser.get("UserFlags")
        MsgBox("old flag:" & oldFlag)

        dim newFlag
        newFlag = oldflag Or flag
        MsgBox("new flag:" & newFlag)

        ' error occurs on next statement !!!!!!!!!!!!!!!!!!
        objUser.put "UserFlags", newFlag

        objUser.SetInfo



Sat, 06 Oct 2001 03:00:00 GMT  
 setting user rights problem using adsi
Hi, Martin, I've copied your code. After changing domainName and userName,
it worked as expected: no error, "user cannot change password" flag set. I'm
using ADSI 2.5 Beta 1. What's your version?
Uwe


Quote:
> *** following is a part of my script to get a user object using adsi

> i always get an error message when trying to set the userflag property.
all
> documentation says this is the right way. also, i do have the correct
> rights. what's wrong?

>         dim flag
>         flag = &H40

>         dim domainName
>         domainName = "thinkinc/sfmgloeckle"
>         dim userName
>         userName = "new"

>         dim objUser
>         set objUser = GetObject("WinNT://" & domainName & "/" & userName)

>         dim oldFlag
>         oldFlag = objUser.get("UserFlags")
>         MsgBox("old flag:" & oldFlag)

>         dim newFlag
>         newFlag = oldflag Or flag
>         MsgBox("new flag:" & newFlag)

>         ' error occurs on next statement !!!!!!!!!!!!!!!!!!
>         objUser.put "UserFlags", newFlag

>         objUser.SetInfo



Thu, 11 Oct 2001 03:00:00 GMT  
 setting user rights problem using adsi
yes, the code should work fine. i'm using asdi 2.0.

i actually took a look at the nt resource kit, found some examples for asdi
2.0 written in Visual Basic. tried them, and got the same error message at
the same point. i assume it is some setup problem with our domain here, and
me not having the correct rights. i am administrator, but not for the full
domain.

if you have any other ideas, let me know.

danke schoen,
- martin


Quote:
> Hi, Martin, I've copied your code. After changing domainName and userName,
> it worked as expected: no error, "user cannot change password" flag set.
I'm
> using ADSI 2.5 Beta 1. What's your version?
> Uwe



> > *** following is a part of my script to get a user object using adsi

> > i always get an error message when trying to set the userflag property.
> all
> > documentation says this is the right way. also, i do have the correct
> > rights. what's wrong?

> >         dim flag
> >         flag = &H40

> >         dim domainName
> >         domainName = "thinkinc/sfmgloeckle"
> >         dim userName
> >         userName = "new"

> >         dim objUser
> >         set objUser = GetObject("WinNT://" & domainName & "/" &
userName)

> >         dim oldFlag
> >         oldFlag = objUser.get("UserFlags")
> >         MsgBox("old flag:" & oldFlag)

> >         dim newFlag
> >         newFlag = oldflag Or flag
> >         MsgBox("new flag:" & newFlag)

> >         ' error occurs on next statement !!!!!!!!!!!!!!!!!!
> >         objUser.put "UserFlags", newFlag

> >         objUser.SetInfo



Fri, 12 Oct 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. WSH ADSI -- Set user rights on NT workstations

2. problems setting user properties with adsi

3. problems setting user properties with adsi

4. ADSI NTFS ACE rights problem

5. Remotely set user rights via script?

6. ADSI User Settings..

7. Set User-Homedirectory with ADSI / WSH

8. Setting Rights using wsh

9. Using ADSI to change NT user properties

10. How can I set permission on a share using VB/ADSI

11. Retreiving a list of Users using ADSI

12. Renaming user accounts using ADSI, example not working

 

 
Powered by phpBB® Forum Software