我已经尝试并尝试将此脚本转换为html: http ://elena-sqldba.blogspot.co.uk/2011/09/moving-ad-user-to-another-ou-using.html
Const ADS_SECURE_AUTHENTICATION = 1
sADDomain = "mydomain"
sADUser = "serviceuser"
sADPassword = "mypassword"
sDestOU = "LDAP://OU=My Group,DC=mydomain,DC=net"
Set objRootDSE = GetObject("LDAP:")
Set objSysInfo = CreateObject("ADSystemInfo")
Set objDestOU = objRootDSE.OpenDSObject(sDestOU, sADDomain & "\" & sADUser, sADPassword, ADS_SECURE_AUTHENTICATION)
Set objUser = objRootDSE.OpenDSObject("LDAP://" & objSysInfo.UserName, sADDomain & "\" & sADUser, sADPassword, ADS_SECURE_AUTHENTICATION)
objDestOU.MoveHere "LDAP://" & objUser.distinguishedName, vbNullString
If Err.Number = 0 Then
MsgBox "User moved successfully."
Else
MsgBox "Error " & Err.Number & ": " & Err.Description
Err.Clear
End If
我已经尝试过了,这就是我想出的:
<html>
<head>
<title>My Page</title>
</head>
<script type="text/vbscript">
Function moveuser()
Const ADS_SECURE_AUTHENTICATION = 1
sADDomain = "mydomain.local"
sADUser = "myusername"
sADPassword = "mypassword"
sDestOU = "LDAP://OU=staff,DC=chs,DC=org,DC=uk"
Set objRootDSE = GetObject("LDAP:")
Set objSysInfo = CreateObject("ADSystemInfo")
Set objDestOU = objRootDSE.OpenDSObject(sDestOU, sADDomain & "\" & sADUser, sADPassword, ADS_SECURE_AUTHENTICATION)
Set objUser = objRootDSE.OpenDSObject("LDAP://" & objSysInfo.UserName, sADDomain & "\" & sADUser, sADPassword, ADS_SECURE_AUTHENTICATION)
objDestOU.MoveHere "LDAP://" & objUser.distinguishedName, vbNullString
If Err.Number = 0 Then
MsgBox "User moved successfully."
Else
MsgBox "Error " & Err.Number & ": " & Err.Description
Err.Clear
End If
End Function
</script>
<body>
<p>
<button onclick="moveuser()">I agree</button>
</p>
</body>
</html>
该脚本在其一个 .vbs 文件上运行良好。我正在尝试使用 IE 10,但收到警告说 IE 已阻止我允许的脚本。我还设置了“初始化和脚本未标记为可安全执行脚本的 ActiveX 控件”以启用。有了所有这些设置,我加载了页面,我只是得到了我的按钮,点击时什么都没有发生?我对这一切都很陌生,我真的不确定我是否做得很好?请帮忙?