Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Reading from Txt file to create multiple mail enabled DLs

Reply
 
Old 03-04-2009   #1 (permalink)
j0seg


 
 

Reading from Txt file to create multiple mail enabled DLs

Hello all,
Here is my question. I've used this script to create a single mail
enabled universal distribution list
and it works fine. We are still running E2K3 and wont be switching for
awhile. I've been beginning to get
more requests to create multiple mail enabled groups and want to try and
have it read from a text file
and try to use the for each method, but I'm afraid if I have them listed not
sure how it will pick up the
"strName" and the rest of the info correctly? I thought about trying to use
the string variables, but not
sure how it will actually work? I suppose I could have each entry listed as
"CN=DL ZZ Mail Users" and keep
adding them in the text file, but what I'm afraid if I use objGroup.Put
displayName it will come out as
CN=DL ZZ Mail Users, and same with sAMAccountName. Then trying to figure
out how to string to remove all
spaces from $strName to create the mailNickName and mail... If anyone has
any suggestions besides using Quest's
ActiveRoles Shell, as I'm trying to use just powerShell command shell. Once
I figure this portion out, I can retain some
of the code to also export users from DLs and perhaps import to DLs for the
larger member lists...

Any help would be appreciated...
Thanks, and sorry if the script is a little raw or makes no sense...I'm
still learning.

joseg
$strDomain = "DC=hrc,DC=root,DC=loc" # Domain variable
$strClass = "Group" # Group variable
$intGroupType = 8 # defines type as a Universal distribution list
$strName = "CN=DL ZZ Mail Testing" # distribution list Name variable
$objADSI = [ADSI]"LDAP://OU=Distribution
Lists,OU=Region-US,DC=hrc,DC=root,DC=loc"
$objGroup = $objADSI.create($strClass, $strName)
$objGroup.Put("GroupType",$IntGroupType)
$objGroup.Put("displayName","DL ZZ Mail Testing")
$objGroup.Put("mailNickname","DLzzMailTesting")
$objGroup.Put("sAMAccountName","DL ZZ Mail Testing")
$objGroup.Put("mail","dlzzMailTesting@xxxxxx")
$objGroup.SetInfo()

My System SpecsSystem Spec
Old 03-04-2009   #2 (permalink)
Flowering Weeds


 
 

Re: Reading from Txt file to create multiple mail enabled DLs


Quote:

> I'm trying to use just powerShell command shell.
FYI

Remember, powershell.exe is a .NET based
automation tool. So perhaps one means by
just automating the .NET classes themselves,
just like one also automates tools (COM and etc.)
within the Windows admin's automation tool,
powershell.exe!

Anyway, have fun automating all kind of objects
and tools, even the .NET classes,
within the Windows admin's automation tool,
powershell.exe!


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Windows Live Mail--Create multiple IMAP folders/move mail in batch Live Mail
Multiple identities -- will they be re-enabled? Vista mail
How to create multiple windows mail database files Vista mail
Vista Media Center won't display with multiple displays enabled. Vista General
Reading mail on multiple computers Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46