<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS : Созадть Почтовый ящик для пользователя]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6826&amp;type=atom" />
	<updated>2012-02-15T12:02:14Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6826</id>
		<entry>
			<title type="html"><![CDATA[VBS : Созадть Почтовый ящик для пользователя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56867#p56867" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Dim oIADSUser
Dim oMailbox

Set oIADS = GetObject(&quot;LDAP://RootDSE&quot;)
strDefaultNC = oIADS.Get(&quot;defaultnamingcontext&quot;)
MsgBox FindAnyMDB(&quot;CN=Configuration,&quot; &amp; strDefaultNC)

&#039;TODO: Use the newly created domain user account to replace the &quot;UserName&quot;.
Set oIADSUser = GetObject(&quot;LDAP://CN=dsa,CN=Users,&quot; &amp; strDefaultNC)

If oIADSUser Is Nothing then
    MsgBox &quot;The oIADSUser is Nothing.&quot;
Else
    MsgBox &quot;The oIADSUser is created successfully.&quot;
End If

Set oMailBox = oIADSUser
oMailbox.CreateMailbox FindAnyMDB(&quot;CN=Configuration,&quot; &amp; strDefaultNC)
oIADSUser.SetInfo

Function FindAnyMDB(strConfigurationNC)
    Dim oConnection
    Dim oCommand
    Dim oRecordSet
    Dim strQuery

    &#039; Open the Connection.
    Set oConnection = CreateObject(&quot;ADODB.Connection&quot;)
    set oCommand = CreateObject(&quot;ADODB.Command&quot;)
    Set oRecordSet = CreateObject(&quot;ADODB.Recordset&quot;)

    oConnection.Provider = &quot;ADsDSOObject&quot;
    oConnection.Open &quot;ADs Provider&quot;

    &#039; Build the query to find the private MDB.
    strQuery = &quot;&lt;LDAP://&quot; &amp; strConfigurationNC &amp; &quot;&gt;;(objectCategory=msExchPrivateMDB);name,adspath;subtree&quot;

    oCommand.ActiveConnection = oConnection
    oCommand.CommandText = strQuery</code></pre></div><p>ТУТ Выдает ошибку http://clip2net.com/s/1AZcN<br /></p><div class="codebox"><pre><code>Set oRecordSet = oCommand.Execute</code></pre></div><div class="codebox"><pre><code>    &#039; If you have an MDB, return the first one.
    If Not oRecordSet.EOF Then
        oRecordSet.MoveFirst
        FindAnyMDB = CStr(oRecordSet.Fields(&quot;ADsPath&quot;).Value)
    Else
        FindAnyMDB = &quot;&quot;
    End If


    &#039;Clean up.
    oRecordSet.Close
    oConnection.Close
    Set oRecordSet = Nothing
    Set oCommand = Nothing
    Set oConnection = Nothing
End Function</code></pre></div><p>Помогите кто сталкивался, просто не силен в VBS</p>]]></content>
			<author>
				<name><![CDATA[afteroot]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25967</uri>
			</author>
			<updated>2012-02-15T12:02:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56867#p56867</id>
		</entry>
</feed>
