AD:组不具有primaryGroupToken属性 [英] AD: Group does not have a primaryGroupToken attribute

查看:586
本文介绍了AD:组不具有primaryGroupToken属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要更改用户的主要组,这样我就可以删除它从它的当前之一。但我的组不具有属性primaryGroupToken,这是我需要的,以改变用户的主组。下面是属性编辑器的截图:

I need to change the primary group of a user, so I can delete it from it's current one. But my group does not have the attribute "primaryGroupToken", which I need in order to change the primary group of the user. Here is a screenshot of the attribute editor:

很显然,我的code没有响应:

Obviously, my code responds nothing:

Dim domainGroup As New DirectoryEntry("LDAP://our.domain/CN=Domain Users,CN=Users,DC=our,DC=domain")
Dim domainGroupGroupToken As String = domainGroup.Properties("primaryGroupToken").Value.ToString()

有没有办法手动设置呢?或者是有什么毛病我的code?先谢谢了。

Is there a way to manually set it? Or is there something wrong with my code? Thanks in advance.

推荐答案

这是一个计算的属性。从这里偷,你只需要将呼叫添加到 RefreshCache 访问属性之前:

It's a computed property. Stealing from here, you just need to add a call to RefreshCache before accessing the property:

Dim domainGroup As New DirectoryEntry("LDAP://our.domain/CN=Domain Users,CN=Users,DC=our,DC=domain")
domainGroup.RefreshCache(New String() {"primaryGroupToken"})
Dim domainGroupGroupToken As String = domainGroup.Properties("primaryGroupToken").Value.ToString()

(没有测试过,我VB是有点生疏)

(Not tested, my VB is a bit rusty)

这篇关于AD:组不具有primaryGroupToken属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆