G
Guest
Hi
I'm trying to apply the "reset password" right to a computer object in Active Directory..
To do this, i used the ActiveDS lib
Whatever i do, i get the 'The security ID is invalid
Here is my little code (in C#)
ActiveDs.IADs dsobject
ActiveDs.IADsSecurityDescriptor sd
ActiveDs.IADsAccessControlList dacl
ActiveDs.AccessControlEntry NewAce
long lflags
string ComputerPath
ComputerPath="LDAP://"+Domain.ToString()+"/CN="+ComputerName.ToString()+",OU=Just Created,OU=IT,OU=Bruxelles,OU=Belgium,OU=all computers,DC=domain,DC=com"
dsobject = dsobject.Get(ComputerPath)
sd = dsobject.Get("ntSecurityDescriptor")
dacl = sd.DiscretionaryAcl
NewAce.AccessMask="accessrights"
NewAce.AceType="accesstype"
NewAce.AceFlags="aceinheritflags"
NewAce.Trustee=UserName.ToString()
dacl.AddAce(NewAce)
sd.DiscretionaryAcl = dacl
dsobject.Put("ntSecurityDescriptor",sd)
dsobject.SetInfo()
I can't figure where's the problem... Is it the approach ? Do i have to use something else ?..
Thanks for reading :
Sneid
I'm trying to apply the "reset password" right to a computer object in Active Directory..
To do this, i used the ActiveDS lib
Whatever i do, i get the 'The security ID is invalid
Here is my little code (in C#)
ActiveDs.IADs dsobject
ActiveDs.IADsSecurityDescriptor sd
ActiveDs.IADsAccessControlList dacl
ActiveDs.AccessControlEntry NewAce
long lflags
string ComputerPath
ComputerPath="LDAP://"+Domain.ToString()+"/CN="+ComputerName.ToString()+",OU=Just Created,OU=IT,OU=Bruxelles,OU=Belgium,OU=all computers,DC=domain,DC=com"
dsobject = dsobject.Get(ComputerPath)
sd = dsobject.Get("ntSecurityDescriptor")
dacl = sd.DiscretionaryAcl
NewAce.AccessMask="accessrights"
NewAce.AceType="accesstype"
NewAce.AceFlags="aceinheritflags"
NewAce.Trustee=UserName.ToString()
dacl.AddAce(NewAce)
sd.DiscretionaryAcl = dacl
dsobject.Put("ntSecurityDescriptor",sd)
dsobject.SetInfo()
I can't figure where's the problem... Is it the approach ? Do i have to use something else ?..
Thanks for reading :
Sneid