|
有VBS可以实现,下面贴上脚本:
Set objOU = GetObject("LDAP://OU=Test,DC=The9,DC=com")
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
Set objWorkbook = objExcel.Workbooks.Open("D:\MailAdress.xls")
Set objWorksheet = objWorkbook.Worksheets(1)
objWorksheet.Activate
Const xlCellTypeLastCell = 11
Set objRange = objWorksheet.UsedRange
objRange.SpecialCells(xlCellTypeLastCell).Activate
intLastRow = objExcel.ActiveCell.Row
For i = 1 To intLastRow
ContactName = Trim(objWorksheet.Cells(i, 1))
MailAdress = Trim(objWorksheet.Cells(i, 2))
objName = split(MailAdress,"@")
Name = objName(0)
Set objContact = objOU.Create("contact", "cn=" & ContactName )
objContact.Put "sn", ContactName
objContact.Put "displayName", ContactName
objContact.Put "mail", MailAdress
objContact.Put "mailNickname", ContactName
objContact.Put "targetAddress", "SMTP:" & MailAdress
objContact.SetInfo
Next
objWorkbook.close
objExcel.quit
具体做法:
1.在D盘根目录建立Excel表格MailAdress.xls
2.表格里每行第一个单元格输入联系人的名称,如:Just;第二行输入mail地址, 如:just@test.com
3.修改脚本:
a.脚本第一行的LDAP后的信息请更改成自己的OU
b.脚本第四行是建立Excel表格的路径,根据自己情况更改
4.保存脚本为vbs后缀,双击运行.
5.如果是Exchange 2007,还需要加东西... |
评分
-
查看全部评分
|