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