ads = win32com.client.Dispatch('ADsNameSpaces')
user = ads.getObject('', 'WinNT://DOMAIN/username,user')
user.Getinfo()
user.Put('userAccountControl', 65536 | user.Get('userAccountControl'))
user.Setinfo()
How can I modify password expiration in Windows using Python?