Снимите флажок * Требовать разрешения пользователя * в ActiveDirectory - PullRequest
0 голосов
/ 05 июня 2019

Я использую следующий скрипт для создания пользователя в активном каталоге

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.Любая идея, что это за свойство или как я могу пройти через все свойства пользовательского объекта, чтобы найти его?

enter image description here

1 Ответ

1 голос
/ 08 июня 2019

Вы можете использовать свойство 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.
...