mbt masai
 
Welcome !
         

                                
After experiencing a lot of down time, We decided to move this site to CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.

 New Mailbox via Powersell

Author Message
morpheus83uk

  • Total Posts : 731
  • Scores: 0
  • Reward points : 0
  • Joined: 8/21/2006
  • Status: offline
New Mailbox via Powersell Sunday, November 15, 2009 11:31 PM (permalink)
0
All,

I have the following:

 
 #Get-Mailbox -Database schemailmb1.stockport.sch.uk #Retrieves a list of Mailboxes from Database
 #Get-Mailbox -server schemail.stockport.sch.uk # Retrieves a list of Mailboxes from Server
 #Get-MailboxStatistics -Database schemailmb1.stockport.sch.uk  # Retrieves Stats for Mailboxes from Database
 #Get-MailboxStatistics -Server schemail.stockport.sch.uk # Retrieves Stats for Mailboxes from Server
 #Get-MailboxDatabase -StorageGroup StorageGroup # Retrieves Stats for mailbox databases from Storage group
 
 #Set Variables
 
 $_DisplayName = "TestScript"
 $_Password = "password"
 $_Alias = "TestScript"
 $_FirstName = "Test"
 $_LastName = "Script"
 $_OU = "Users"
 $_PrincipalName = "test.script@domain.com"
 $_Database = "Storage Group A\Mailbox Database A"
 $_I = 0
 
 #Loop round CSV File and create new mailboxes
 
 Do {New-Mailbox -DisplayName $_DisplayName -Password $_Password -Alias $_Alias -FirstName $_FirstName -LastName $_LastName -OrganizationalUnit $_OU -UserPrincipalName $_PrincipalName -Database $_Database; $_I++}
 Until ($_I = 1)
 
 


However I am using primalscript and I am getting the following in the output when running it:

ERROR: Add-PSSnapin : Cannot add Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.Admin because it is already added. Verify the name of the snap-in and try again.
ERROR: At line:7 char:13
ERROR: + Add-PSSnapin  <<<< Microsoft.Exchange.Management.PowerShell.Admin
ERROR: Add-PSSnapin : Windows PowerShell snap-in Microsoft.Exchange is not installed on the machine.
ERROR: At line:8 char:13
ERROR: + Add-PSSnapin  <<<< Microsoft.Exchange, Microsoft.Windows.AD
ERROR: Add-PSSnapin : Windows PowerShell snap-in Microsoft.Windows.AD is not installed on the machine.
ERROR: At line:8 char:13
ERROR: + Add-PSSnapin  <<<< Microsoft.Exchange, Microsoft.Windows.AD
ERROR: New-Mailbox : Cannot bind parameter 'Password'. Cannot convert value "password" to type "System.Secu
ERROR: rity.SecureString". Error: "Invalid cast from 'System.String' to 'System.Security.SecureString'."
ERROR: At line:23 char:53
ERROR: + Do {New-Mailbox -DisplayName $_DisplayName -Password  <<<< $_Password -Alias $_Alias -FirstName $_
ERROR: FirstName -LastName $_LastName -OrganizationalUnit $_OU -UserPrincipalName $_PrincipalName -Database
ERROR:  $_Database; $_I++}

*** PowerShell Script finished. ***

Can anyone shed any light on this matter?

Many Thanks

James
#1
    ebgreen

    • Total Posts : 8088
    • Scores: 95
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    Re:New Mailbox via Powersell Monday, November 16, 2009 5:00 AM (permalink)
    0
    I do not work with exchange, so I can't really help with this. Have you asked in the exchange section of the forum at powershellcommunity.org?
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
    #2
      morpheus83uk

      • Total Posts : 731
      • Scores: 0
      • Reward points : 0
      • Joined: 8/21/2006
      • Status: offline
      Re:New Mailbox via Powersell Monday, November 16, 2009 8:56 PM (permalink)
      0
      Hello,

      I havent however I will do.

      Many Thanks I will let you know how I get on

      James
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.8
        mbt shoes www.wileywilson.com