Tim Golden rocks! - workaround for Active Directory null strings!

home | blog | Terrible people and places | Covid-19 links | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts




I found that when I was trying to "Un-set" a user property, I could not do it by passing a null string, None, or anything else I tried.
I was using Tim Golden's active_directory module and found his work-around here:
http://mail.python.org/pipermail/python-win32/2011-February/011199.html line In case the link goes away, here is the line you need:
PutEx 1st parameter is:
Const ADS_PROPERTY_CLEAR = 1
Const ADS_PROPERTY_UPDATE = 2
Const ADS_PROPERTY_APPEND = 3
Const ADS_PROPERTY_DELETE = 4

Since clear works for my case, I did not test other cases for delete or append. Good luck!
import active_directory as ad

me = ad.find_user ()
me.PutEx (1, "telephoneNumber", "IRRELEVANT")

The key being the string can't be null, so set it to what-ever you want!
Thanks Tim!



[æ]