MCPcopy Create free account
hub / github.com/Synzack/ldapper / GetMachineQuota

Function GetMachineQuota

Queries/QueryMachineQuota.go:10–28  ·  view source on GitHub ↗
(baseDN string, conn *ldap.Conn)

Source from the content-addressed store, hash-verified

8)
9
10func GetMachineQuota(baseDN string, conn *ldap.Conn) (queryResult string) {
11 query := ("(objectClass=domain)")
12 searchReq := Globals.LdapSearch(baseDN, query)
13
14 result, err := conn.Search(searchReq)
15 if err != nil {
16 fmt.Printf("Query error, %s", err)
17 }
18
19 if len(result.Entries[0].GetAttributeValues("ms-DS-MachineAccountQuota")) > 0 {
20 machineQuota := result.Entries[0].GetAttributeValues("ms-DS-MachineAccountQuota")[0]
21 queryResult = fmt.Sprintf("Machine Account Quota: %s\n", machineQuota)
22 return
23 } else {
24 queryResult = "No results for ms-DS-MachineAccountQuota.\n"
25 }
26
27 return
28}

Callers 1

mainFunction · 0.92

Calls 1

LdapSearchFunction · 0.92

Tested by

no test coverage detected