M
M
mr jeery2017-10-24 16:40:43
Active Directory
mr jeery, 2017-10-24 16:40:43

How to unload a list of computers from AD without Powershell?

There are no permissions in Powershell.
In HELL the rights and in printmanagement.msc of the right are on reading.
1. I want to unload all computers and check for free ones, since PC names with already four-digit numbers have bred. I check in python, for example, I understand how to do it. And how to unload the list of computers?
2. There are a lot of network printers and it is not clear whether such a person has rights to such a printer. How to do this in python?
I use a script in cmd and see if there is a certain person in the list.

dsquery group -samid Xerox-6204w-02 | dsget group -members -expand|find /v "_g"| dsget user -display > c:\log.txt

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
eugenyg, 2017-11-16
@eugenyg

For example:

from ldap3 import Server, Connection, AUTO_BIND_NO_TLS, SUBTREE, ALL_ATTRIBUTES

def get_ldap_info():
    with Connection(Server('127.0.0.1', port=636, use_ssl=True),
                    auto_bind=AUTO_BIND_NO_TLS,
                    read_only=True,
                    check_names=True,
                    user='DOMAIN\\username', password='password') as c:

        c.search(search_base='CN=Computers,DC=example,DC=com',
                 search_filter='(&(objectClass=computer))',
                 search_scope=SUBTREE,
                 attributes=ALL_ATTRIBUTES,
                 get_operational_attributes=True)

    print(c.response_to_json())
    print(c.result)

get_ldap_info()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question