Script to remove login script by OU. 
Author Message
 Script to remove login script by OU.

I am trying to remove all the login scripts that I have in the profile
section of the user account. Is there a way that i can do this by OU, i dont
want to remove this from everyone, only from users in particular OU's.

Thanks
Gavin...



Tue, 09 Aug 2005 04:11:58 GMT  
 Script to remove login script by OU.
Once you have the user object from the OU to clear the scriptpath do this:

Const ADS_PROPERTY_CLEAR  = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4

' Clear the scriptpath
 oAdUser.PutEx ADS_PROPERTY_CLEAR,"scriptPath", 0


Quote:
> I am trying to remove all the login scripts that I have in the profile
> section of the user account. Is there a way that i can do this by OU, i
dont
> want to remove this from everyone, only from users in particular OU's.

> Thanks
> Gavin...



Tue, 09 Aug 2005 05:30:38 GMT  
 Script to remove login script by OU.
This is what i have done, but it did not seem to work...any ideas why. It
does not give any errors, but nothing changes

Dim oADUser

Const ADS_PROPERTY_CLEAR  = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4

set OU = GetObject("LDAP://OU=USERS,OU=MIS,DC=LOCAL,DC=NET")

For Each oADUser in OU
'Make sure they are only USER class.
if oADUser.Class = "user" Then
' Clear the scriptpath
oADUser.PutEx ADS_PROPERTY_CLEAR,"scriptPath", 0

End If
Next

Thanks
Gavin...



Quote:
> Once you have the user object from the OU to clear the scriptpath do this:

> Const ADS_PROPERTY_CLEAR  = 1
> Const ADS_PROPERTY_UPDATE = 2
> Const ADS_PROPERTY_APPEND = 3
> Const ADS_PROPERTY_DELETE = 4

> ' Clear the scriptpath
>  oAdUser.PutEx ADS_PROPERTY_CLEAR,"scriptPath", 0



> > I am trying to remove all the login scripts that I have in the profile
> > section of the user account. Is there a way that i can do this by OU, i
> dont
> > want to remove this from everyone, only from users in particular OU's.

> > Thanks
> > Gavin...



Tue, 09 Aug 2005 06:56:41 GMT  
 Script to remove login script by OU.
Hi,

To enumerate all users in an OU, bind to the OU, filter on
users, and enumerate. You must use the LDAP provider. I
hard coded the distinguished name of a nested OU in my
example below. It could be
strOU = "ou=Sales,cn=MyDomain,dc=com"

Const ADS_PROPERTY_CLEAR  = 1
strOU = "ou=East,ou=Sales,dc=MyDomain,dc=com"
Set objOU = GetObject("LDAP://" & strOU)
objOU.Filter = Array("user")
For each objUser In objOU
  objUser.PutEx ADS_PROPERTY_CLEAR, "scriptPath", 0
Next

Richard

Quote:
>-----Original Message-----
>Once you have the user object from the OU to clear the
scriptpath do this:

>Const ADS_PROPERTY_CLEAR  = 1
>Const ADS_PROPERTY_UPDATE = 2
>Const ADS_PROPERTY_APPEND = 3
>Const ADS_PROPERTY_DELETE = 4

>' Clear the scriptpath
> oAdUser.PutEx ADS_PROPERTY_CLEAR,"scriptPath", 0



>> I am trying to remove all the login scripts that I have
in the profile
>> section of the user account. Is there a way that i can
do this by OU, i
>dont
>> want to remove this from everyone, only from users in
particular OU's.

>> Thanks
>> Gavin...

>.



Tue, 09 Aug 2005 07:09:12 GMT  
 Script to remove login script by OU.
Thanks for the help, i found the mistake...this one works perfectly

Dim oADUser

Const ADS_PROPERTY_CLEAR  = 1

set OU = GetObject("LDAP://OU=USERS,OU=MIS,DC=LOCAL,DC=NET")

For Each oADUser in OU
'Make sure they are only USER class.
if oADUser.Class = "user" Then
' Clear the scriptpath
oADUser.PutEx ADS_PROPERTY_CLEAR,"scriptPath", 0
'This is what i was missing
oADUser.SetInfo
End If
Next


Quote:
> Hi,

> To enumerate all users in an OU, bind to the OU, filter on
> users, and enumerate. You must use the LDAP provider. I
> hard coded the distinguished name of a nested OU in my
> example below. It could be
> strOU = "ou=Sales,cn=MyDomain,dc=com"

> Const ADS_PROPERTY_CLEAR  = 1
> strOU = "ou=East,ou=Sales,dc=MyDomain,dc=com"
> Set objOU = GetObject("LDAP://" & strOU)
> objOU.Filter = Array("user")
> For each objUser In objOU
>   objUser.PutEx ADS_PROPERTY_CLEAR, "scriptPath", 0
> Next

> Richard
> >-----Original Message-----
> >Once you have the user object from the OU to clear the
> scriptpath do this:

> >Const ADS_PROPERTY_CLEAR  = 1
> >Const ADS_PROPERTY_UPDATE = 2
> >Const ADS_PROPERTY_APPEND = 3
> >Const ADS_PROPERTY_DELETE = 4

> >' Clear the scriptpath
> > oAdUser.PutEx ADS_PROPERTY_CLEAR,"scriptPath", 0



> >> I am trying to remove all the login scripts that I have
> in the profile
> >> section of the user account. Is there a way that i can
> do this by OU, i
> >dont
> >> want to remove this from everyone, only from users in
> particular OU's.

> >> Thanks
> >> Gavin...

> >.



Tue, 09 Aug 2005 07:29:58 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Removing Netbeui via a login script...

2. OU User Reporting script...

3. Educational - Adding Multiple user to an OU script

4. Add User to OU with VB Script

5. Logon Scripts by OU

6. OU membership in a Script???

7. OU Script

8. how to make script execute function only for particular OU

9. see to what OU a user belongs to from a logon script

10. Qualite image BMP ou TIF ou JPG ?

11. Access vers SQL/serveur ou Oracle : quels pi├Ęges ou conseils

12. Acquisition sur PC - serie ou // ou ...?

 

 
Powered by phpBB® Forum Software