active directory - How to use Python to get local admins from a computer on the Network? -


i need list of people in company have local admin rights on computers. have group on each machine called "administrators." can list of computers active directory with:

import active_directory  computer in active_directory.search ("objectcategory='computer'"):   print computer.displayname 

now think need take each computer name , feed in. thinking maybe reading remote registry on each computer , looking sid -- supposedly sid 's-1-5-domain-500' give me list of people on computer local admins. did:

import _winreg computer_name = "fakecomputername" key_path = r"system\currentcontrolset\control\computername\computername" hklm_remote = _winreg.connectregistry (r"\\%s" % computer_name, _winreg.hkey_local_machine) hkeyremote = _winreg.openkey (hklm_remote, key_path, 0, _winreg.key_read) value, type = _winreg.queryvalueex (hkeyremote, "computername") print "remote computer name is", value remote computer name fakecomputername 

how combine these need? these work together? best way go this? once work can figure out writing file , adding exceptions if computer isn't on network writes , moves onto next pc. perhaps use win32security?

i don't know registry key use or if work. i've spent 5 hours on today , still learning python. don't know vb , majority of code see on net.

thanks!

is data operation going manipulated afterwards? if manual scan going looked @ human, you're way overthinking it.

just use network scanner handle you, such this one.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -