Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   Microsoft Exchange Server (http://forum.oszone.net/forumdisplay.php?f=76)
-   -   Как добавить почтовый ящик с exchange в outlook 2010 через командную строку (http://forum.oszone.net/showthread.php?t=212193)

VIPer7 29-07-2011 10:52 1722109

Как добавить почтовый ящик с exchange в outlook 2010 через командную строку
 
Прошу совета
Как добавить почтовый ящик с exchange в outlook 2010 через командную строку
например user1@mycompany.com уже есть и надо добавить ещё один user2@mycompany.com
Именно почтовый ящик (account) а не profile

нужно добавить один почтовый ящик нескольким юзерам домена
туда будут приходить факсы и он будет доступен только этим юзерам
В ручную сделать это трудновато (юзеров 10-20) хотелось бы автоматизировать этот процесс через логинскрипт
много гуглил но нашел только http://www.itefix.no/i2/texprof
не совсем подходит...

Texprof is a small command-line utility that allows you to create Outlook profiles for Exchange. It may be useful during Exchange migrations or profile maintenance via login scripts. It supports all windows platforms (95 to 2003). It accepts three arguments :

profile name
exchange server name
mailbox name
Example :

texprof MyProfile EXCHSERV userid

zero55 29-07-2011 12:11 1722161

В профиль вы больше одного exchange-аккаунта не добавите.

Oleg Krylov 29-07-2011 12:26 1722169

Цитата:

Цитата zero55
В профиль вы больше одного exchange-аккаунта не добавите. »

Отчего же? В 2010 у меня три :)

VIPer7 29-07-2011 13:02 1722190

zero55,
Может быть в более старых версиях(outlook,exchange) и нельзя было
у меня outlook 2010 можно добавить хоть 10
вопрос в том как это сделать через login script

zero55 29-07-2011 13:03 1722191

Цитата:

Цитата Oleg Krylov
В 2010 у меня три »

Подцепленных вторым ящиком?
Этих можно напихать сколько угодно...

Скриптом их все равно не добавить.

VIPer7 29-07-2011 13:11 1722198

Цитата:

Цитата zero55
Скриптом их все равно не добавить. »

Профиль добавить скриптом проблем нет
Неужели аккаунт нельзя?

Oleg Krylov 29-07-2011 13:16 1722203

Цитата:

Цитата zero55
Подцепленных вторым ящиком? »

Почитайте про Multiple Exchange Account in Outlook 2010.
VIPer7, попробуйте вот так: http://technet.microsoft.com/en-us/l.../ee815819.aspx
Но придется запускать установку, если я правильно понял. Установку можно запустить logon-скриптом.
На шаге 8 снимите галку Overwrite Existing Exchange Account.

zero55 29-07-2011 13:16 1722204

оказывается можно.
нашел у себя в архиве вот такой скриптик.
Скажу сразу не проболвал...
Код:

Const PR_STORE_PROVIDERS = &H3D000102
Const PR_PROVIDER_UID = &H300C0102
Const PR_DISPLAY_NAME = &H3001001E
Const PR_PROFILE_MAILBOX = &H660B001E
Const PR_PROFILE_SERVER = &H660C001E
Const PR_PROFILE_SERVER_DN = &H6614001E
Const PR_EMAIL_ADDRESS = &H3003001E
Dim sTitle,sMessage, iKount
sMailBoxName = InputBox("Enter the name of the mailbox to add","Add
Additional Mailbox")
' look up in ad to see if it exists
Set Conn = CreateObject("ADODB.Connection")
Conn.Open "Provider=ADsDSOObject;"
Set Cmd = CreateObject("ADODB.Command")
Cmd.ActiveConnection = Conn
Cmd.CommandText = "<GC://dc=example,dc=com>;(&(objectCategory=person)
(|(displayName=*" & sMailBoxName & "*) (sAMAccountName=*" &sMailBoxName &
"*)));displayName,sAMAccountName;subtree"
Set Rst = Cmd.Execute
If Rst.RecordCount = 1 Then
  ' found exact match
  ' assume mailbox id is the sAMAccountName
  sMailBoxID = Rst.Fields("sAMAccountName")
  sMailSvr = "MAILSERVER1" ' the mail server the mailbox is on
  sMailBoxDN = "/o=example/ou=staff/cn=Recipients/cn=" & sMailBoxID
  sServerDN = "/O=example/OU=staff/cn=Configuration/cn=Servers/cn=" &
sMailSvr
  AddMailBox "",sMailBoxName,sMailBoxDN,sMailSvr,sServerDN
  MsgBox "The mailbox for " & Rst.Fields("displayName") & "has been added.
Please check that it has been added to your profile " & _
          "correctly. If there is still a problem please report it to the
Service Desk ",0,"Finished"
Else
  If Rst.RecordCount = 0 Then
      ' not found
      sTitle = "Mailbox not found"
      sMessage = "Unable to add mailbox for " & sMailBoxName & ". The
mailbox cannot be found."
  Else
      ' multiple entries found
      sTitle = Rst.RecordCount & " mailbox"
      If Rst.RecordCount > 1 Then
        sTitle = sTitle & "es"
      End If
      sTitle = sTitle & " found"
      sMessage = "Unable to add mailbox for " & sMailBoxName & ". There are
multiple mailboxes that meet the " & _
                "specified criteria "
      If Rst.RecordCount < 30 Then
        sMessage = "Unable to add mailbox for " & sMailBoxName & ". There
are multiple mailboxes that meet the " & _
                "specified criteria as listed below:" & vbCrLf & vbCrLf
        For iKount = 1 To Rst.RecordCount
            If iKount < 10 Then
              sMessage = sMessage & "    "
            Else
              sMessage = sMessage & "  "
            End If
            sMessage = sMessage & CStr(iKount) & ". " &
Rst.Fields("displayName") & " - " & Rst.Fields("sAMAccountName") & vbCrLf
            Rst.MoveNext
        Next
      Else
        sMessage = "Unable to add mailbox for " & sMailBoxName & ". There
are too many mailboxes that " & _
                    "matched the criteria to list." & vbCrLf
      End If
      sMessage = sMessage & vbCrLf & "Please re-run this program and enter a
more specific mailbox name."
  End If
  MsgBox sMessage, 0, sTitle
End If
' clean up
Rst.Close
Set Rst = Nothing
Set Cmd = Nothing
Conn.Close
Set Conn = Nothing
Sub AddMailBox(strProfile, strDisplayName, strMailboxDN, strServer,
strServerDN)
  Set Profiles=CreateObject("ProfMan.Profiles")
  If strProfile = "" Then
    Set Profile = Profiles.DefaultProfile
  Else
    Set Profile = Profiles.Item(strProfile)
  End If
  'find the Exchange service
  Set Services = Profile.Services
  For i = 1 To Services.Count
    Set Service = Services.Item(i)
    If Service.ServiceName = "MSEMS" Then
      'Add "EMSDelegate" provider
      Set Properties = CreateObject("ProfMan.PropertyBag")
      Properties.Add PR_DISPLAY_NAME, strDisplayName
      Properties.Add PR_PROFILE_MAILBOX, strMailboxDN
      Properties.Add PR_PROFILE_SERVER, strServer
      Properties.Add PR_PROFILE_SERVER_DN, strServerDN
      Set Provider = Service.Providers.Add("EMSDelegate", Properties)
      'update the old value of PR_STORE_PROVIDERS so that Outlook
      'will show the mailbox in the list in Tools | Services
      Set GlobalProfSect = Profile.GlobalProfSect
      OldProviders = GlobalProfSect.Item(PR_STORE_PROVIDERS)
      strUID = Provider.UID
      GlobalProfSect.Item(PR_STORE_PROVIDERS) = OldProviders & strUID
    End If
  Next
End Sub



Время: 03:31.

Время: 03:31.
© OSzone.net 2001-