Jump to content

Posfach mit Script anlegen


Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte erstelle einen neuen Beitrag zu Deiner Anfrage!

Empfohlene Beiträge

Geschrieben

Hallo zusammen

 

Ich habe folgendes Problem. Ich möchte mit vb Script auf meinem Exchange Server 2003 Postfächer anlegen. Kann mir jemand helfen. Wäre euch sehr dankbar.

 

Liebe Grüsse

Singe

Geschrieben

Danke für deine schnelle Antwort. Wollte dieses Script benützen

aber erhalte immer eine Fehlermeldung.

 

Hier mein Script:

 

Dim fso, f, Zeile, Feld

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.OpenTextFile ("user2.txt",1,0)

 

Do while not f.AtEndOfLine

Zeile = f.readLine

Feld = split(Zeile,",")

Benutzer = Feld(0)

Vorname = Feld(1)

Nachname = Feld(2)

Passwort = Feld(3)

Mail = Feld(4)

Call BenuntzerAnlegen(Benutzer,Vorname,Nachname,Passwort,Mail)

Loop

f.Close

Wscript.Quit(0)

 

Sub BenuntzerAnlegen (Benutzer,Vorname,Nachname,Passwort,Mail)

Dim ouo, b

Set ouo = GetObject("LDAP://CN=Users,DC=itnetworx,DC=ch")

Set b = ouo.Create("user", "CN=" & Vorname & " " & Nachname)

Dim WshShell, ret

Set WshShell = WScript.CreateObject("WScript.Shell")

b.Put "sAMAccountName", Benutzer

b.Put "userPrincipalName", Benutzer & "@itnetworx.ch"

b.Put "mail", Mail & "@itnetworx.ch"

b.Put "profilePath", "\\itxerhf01\Daten\Test\profile\" & Benutzer

b.Put "homeDirectory", "\\itxerhf01\Daten\Test\home\" & Benutzer

b.Put "homeDrive", "U:"

b.SetInfo

 

'use CDOEXM to create mailbox, this is not possible with ADSI

'when using this script take care of the correct names !

 

Set objMailbox = b

objMailbox.CreateMailbox ("LDAP://itnetworx/CN=" + SG + ",CN=InformationStore,CN=itnetworx,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=itnetworx ASP,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=itnetworx,DC=ch")

 

'use IMailboxStore interface from CDOEXM to set Store Limits

 

objMailbox.EnableStoreDefaults = true

objMailbox.StoreQuota = 10000

objMailbox.OverQuotaLimit = 12000

objMailbox.HardLimit = 15000

 

' set password and enable account

 

 

 

b.SetPassword Passwort

b.AccountDisabled = true

b.SetInfo

WScript.Sleep(1000)

ret = WshShell.Run ("verz.cmd " & Benutzer,0,1)

End Sub

 

Fehlermeldung.

Line 36, Char 1, Invalid Argument, ID no: c103071f Microsoft CDO Exchange Management

 

 

Ich weiss einfach nicht mehr weiter. Bitte um Hilfe. Besten Dank

 

Singe

Geschrieben

Hallo hab es mit dem Script probiert das du mir per link gschickt hast.

 

Mein Code:

 

org="itnetworx.ch"

SG="Postfachspeicher(itxerhf01),CN=Erste Speichergruppe"

 

' bind to container, create user and set some (basic) settings

 

Set ou = GetObject("LDAP://OU=" + org + ", DC=itnetworx, DC=ch")

Set usr = ou.Create("user", "cn=JSmith")

usr.Put "samAccountName", "jsmith"

usr.givenName = "John"

usr.sn = "Smith"

usr.displayName = "John Smith"

usr.userPrincipalName = jsmith

usr.mail = JSmith

usr.SetInfo

 

'use CDOEXM to create mailbox, this is not possible with ADSI

'when using this script take care of the correct names !

 

Set objMailbox = usr

objMailbox.CreateMailbox ("LDAP://itxerhf01/CN=" + SG + ",CN=InformationStore,CN=itxerhf01,CN=Servers,Erste Administrative Gruppe,CN=Administrative Groups,CN=itnetworx,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=itnetworx,DC=ch")

 

'use IMailboxStore interface from CDOEXM to set Store Limits

 

objMailbox.EnableStoreDefaults = FALSE

objMailbox.StoreQuota = 10000

objMailbox.OverQuotaLimit = 12000

objMailbox.HardLimit = 15000

' set password and enable account

usr.setPassword "password"

usr.AccountDisabled = False

usr.SetInfo

wscript.echo "Finished!"

 

Jetzt erhalte ich die Fehlermeldung:

 

Line 6. Char 1,,, Ther is no such object on the server, Code 80072030

 

Besten Dank für Eure Hilfe

 

Lieber Gruss

Singe

Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte erstelle einen neuen Beitrag zu Deiner Anfrage!

Erstelle ein Benutzerkonto oder melde dich an, um zu kommentieren

Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können

Benutzerkonto erstellen

Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!

Neues Benutzerkonto erstellen

Anmelden

Du hast bereits ein Benutzerkonto? Melde dich hier an.

Jetzt anmelden
×
×
  • Neu erstellen...