我尝试过并尝试将此脚本转换为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>
该脚本在一个ina .vbs文件中正常工作。我试图使用IE 10,我得到警告说IE已经阻止了我允许的脚本。我还设置了“初始化和脚本ActiveX控件未标记为脚本安全”以启用。有了这一切,我加载页面,我只是得到我的按钮,点击时没有任何反应?我对这一切都很陌生,我真的不确定我是否做得好吗?请帮忙?