Hi,
I am trying to create a Exchange Powershell command so it will create a list of users in a .csv file put them in Active Directory, a specific OU, assign them an email address and set them a password
the following command i have found is:
$users = Import-CSV C:\users.csv
$users| foreach-object
{
$Password = convertto-securestring $_.password -asplaintext -force
new-mailbox -name $_.name -alias $_.alias -FirstName $_.Firstname -LastName $_.Lastname -userPrincipalName $_.UPN -database $_.Database -OrganizationalUnit $_.OUpath -Password $Password –ResetPasswordOnNextLogon:$true
}
I cannot get this working at all :-(
I keep getting the error
ForEach-Object : Cannot bind parameter 'Process'. Cannot convert the "{" value
of type "System.String" to type "System.Management.Automation.ScriptBlock".
At line:1 char:23
+ $users| foreach-object <<<<
+ CategoryInfo : InvalidArgument: (:) [ForEach-Object], Parameter
BindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerSh
ell.Commands.ForEachObjectCommand
my CSV is attached