I hope that I can explain the situation here correctly.I have a list with 100 users who I want to disable their e-mail account AND their internet account.
what I did was that reading the user from this list and pass it to your function which fined the OU path for it and then disable the account, this part worked excellent.
I thought this part will disable the e-mail account and internet account but it Did Not.
What I understood is that when the user want to log in to the internet, he will be authenticated from deferent LDAP server and I got the name of this server (i.e st8en1.dhw.zain.com.st).
So, In your first code and specifically in the following line:
$AdoCommand.CommandText ="Select AdsPath, samAccountName, GroupType from 'LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")+"' "+$filter
I tried to replace ("LDAP://rootDSE") with ("LDAP://st8en1.dhw.zain.com.st ")
But it seems to me that it did not work.
Please help.
