Function Main()
set RT = CreateObject ("ADODB.Connection")
RT.Open "kadr-sql", "", ""
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
While Not rs.EOF
fio = RS.Fields("displayName").Value
email = RS.Fields("mail").Value
tabnam = TRIM (RS.Fields("employeeID").Value)
Set RS1 = RT.Execute("EXEC ad_users_reg @fio = '" & fio &"' , @tabnam ='"&tabnam&"', @email = '" & email & "' ")
RS.MoveNext
Wend
objConnection.Close
RS = Close
SET RS = Nothing
RS1 = Close
SET RS1 = Nothing
RT = Close
SET RT = Nothing
Main = DTSTaskExecResult_Success
End Function
set RT = CreateObject ("ADODB.Connection")
RT.Open "kadr-sql", "", ""
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
Код |
---|
Set RS = objConnection.Execute("<LDAP://domen.ru>; displayName=*);displayName, <br />cn,name,EmployeeID,displayName <br />,sAMAccountName,mail,otherTelephone,telephoneNumber,pager, <br />physicalDeliveryOfficeName,pwdLastSet,telephoneNumber,title, <br />l,streetAddress,userAccountControl,proxyAddresses,memberOf;subtree") |
While Not rs.EOF
fio = RS.Fields("displayName").Value
email = RS.Fields("mail").Value
tabnam = TRIM (RS.Fields("employeeID").Value)
Set RS1 = RT.Execute("EXEC ad_users_reg @fio = '" & fio &"' , @tabnam ='"&tabnam&"', @email = '" & email & "' ")
RS.MoveNext
Wend
objConnection.Close
RS = Close
SET RS = Nothing
RS1 = Close
SET RS1 = Nothing
RT = Close
SET RT = Nothing
Main = DTSTaskExecResult_Success
End Function