我正在尝试使用GADS将我们的Active Directory组成员身份同步到Google Apps群组。对于组(A)中的新用户,它可以正常工作并添加到Google网上论坛。但是,当我从Active Directory中的A组中删除该用户并运行GADS同步时,该用户仍然留在GoogleApps中的A组中。
我错过了什么或者GADS应用程序有什么问题吗?我在Windows Server 2008 R2计算机上使用Google Apps Directory Sync版本4.2.1。
谢谢,
的Trinh
答案 0 :(得分:1)
作为第一步,我建议更新到最新的GADS,4.3.2。
完成此操作后,如果您可以重现此问题,则您需要生成跟踪级别日志并搜索相关用户。我还建议您重命名.log文件,以便它只包含一个同步。这将为您提供有关未删除原因的更多信息。
日志可能包含太多信息,您无法进行消毒和公开发布。我建议打开带有.log文件和XML的Google案例。 Google支持可能还需要您的LDAP和LDIF,但并非总是如此。
答案 1 :(得分:0)
我最终通过编写python脚本来回答这个问题:
http://www.dangtrinh.com/2016/07/get-all-ms-active-directory-group.html
http://www.dangtrinh.com/2016/07/get-google-group-members-using-gam-and.html
这是工作脚本:
#! /usr/bin/env python
import shlex, subprocess
import sys
# ad_utils.py: http://www.dangtrinh.com/2016/07/get-all-ms-active-directory-group.html
import ad_utils
GADMIN_ACCOUNT = '<your google apps administrator email>'
GAM_PATH = '/path/to/your/gam.py'
GOOGLE_GROUPS = {
'<group name>': 'group email',
...
}
def get_group_members(group_email, gam_path=GAM_PATH):
cmd = 'python %s print group-members group %s' % (gam_path, group_email)
if sys.platform == 'win32':
cmd = 'gam print group-members group %s' % (group_email)
args = shlex.split(cmd)
proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proc.communicate()
members = []
if proc.returncode == 0:
if out:
out = out.split('\n')
for i in range(1, len(out)):
row = out[i].split(',')
if len(row) >= 3:
if row[2].lower() != GADMIN_ACCOUNT: # exclude gadmin account
members.append(row[2].lower())
return members
def del_group_member(group_email, member_email, gam_path=GAM_PATH):
cmd = 'python %s update group %s remove user %s' % (gam_path, group_email, member_email)
if sys.platform == 'win32':
cmd = 'gam update group %s remove user %s' % (group_email, member_email)
args = shlex.split(cmd)
proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = proc.communicate()
return proc.returncode, out, err
def sync_ad_gapps_group_members(group_name, group_email, ad_conn, dry_run=False):
ad_members = ad_utils.get_group_members(group_name, ad_conn)
if ad_members:
googlegroup_members = get_group_members(group_email)
for guser in googlegroup_members:
if guser not in ad_members:
print "=== %s not active in AD" % guser
if dry_run:
pass
else:
del_group_member(group_email, guser)
def sync_ad_gapps_groups(dry_run=False):
ad_conn, ad_result = ad_utils.ad_auth()
if ad_result:
for gname, gemail in GOOGLE_GROUPS.iteritems():
print "\n+++ Syncing group %s" % gname
sync_ad_gapps_group_members(gname, gemail, ad_conn, dry_run)
else:
print "Fail!"
if __name__ == "__main__":
dry_run = False
if len(sys.argv) > 1:
dry_run = bool(sys.argv[1])
if dry_run:
print "=== Running Google Apps Groups sync in dry-run mode"
print "==== Dry running: %s" % dry_run
sync_ad_gapps_groups(dry_run)
<强>用法:强>
$ python google_groups_ad_sync.py [dry_run]
您可以设置在GADS之后运行此脚本的计划任务。