在 Active Directory 中取消选中 *Require users permission* 复选框

Uncheck *Require user's permission* checkbox in ActiveDirectory

我使用以下脚本在活动目录中创建用户

Set objRootLDAP = GetObject("LDAP://rootDSE")
strRoot = objRootLDAP.Get("DefaultNamingContext")
Set objContainer = GetObject("LDAP://OU=Users-New Profile,OU=Users,OU=company," & strRoot)
Set objNewUser = objContainer.Create("User", "cn=" & sSAMAccountName)
objNewUser.sAMAccountName = sSAMAccountName
objNewUser.SetInfo
objNewUser.userPrincipalName = sSAMAccountName & "@domain.com"
objNewUser.givenName = sFirstName
objNewUser.sn = sLastName
objNewUser.mail = sSAMAccountName & "@domain.com"
objNewUser.DisplayName = sFullName
objNewUser.homeDirectory = "\server\users$\" & sSAMAccountName
objNewUser.homeDrive = "H:"
objNewUser.tsProfilePath = "\server\users$\" & sSAMAccountName
objNewUser.tsHomeDirDrive = "H:"
objNewUser.AccountDisabled = False
objNewUser.SetPassword "Password"
objNewUser.pwdLastSet = CLng(0)
objNewUser.SetInfo

我的问题是我不知道如何取消选中 ADUC 中用户属性 window 的远程控制选项卡上的 需要用户许可 复选框。知道 属性 是什么,或者我如何遍历用户对象的所有属性来找到它?

您可以在新用户上使用EnableRemoteControl 属性:

objNewUser.EnableRemoteControl = 2

将此设置为以下任何值:

Disable                0  Remote control is disabled.
EnableInputNotify      1  The user of remote control has full control of the user's session, with the user's permission.
EnableInputNoNotify    2  The user of remote control has full control of the user's session; the user's permission is not required.
EnableNoInputNotify    3  The user of remote control can view the session remotely, with the user's permission; the remote user cannot actively control the session.
EnableNoInputNoNotify  4  The user of remote control can view the session remotely, but not actively control the session; the user's permission is not required.