win32net.NetUserGetLocalGroups

Here are the examples of the python api win32net.NetUserGetLocalGroups taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: pysecdump
Source File: user.py
View license
    def get_groups(self):
        if self.member_of:
            return self.member_of

        from wpc.group import group as Group # we have to import here to avoid circular import

        g1 = []
        g2 = []

        try:
            g1 = win32net.NetUserGetLocalGroups(wpc.conf.remote_server, self.get_name(), 0)
        except:
            pass
        try:
            g2 = win32net.NetUserGetGroups(wpc.conf.remote_server, self.get_name())
        except:
            pass
        for g in g2:
            g1.append(g[0])
        for group in g1:
            gsid, s, i = wpc.conf.cache.LookupAccountName(wpc.conf.remote_server, group)
            self.member_of.append(Group(gsid))

        return self.member_of