I am working on a script that reads an Excel spreadsheet to get data to create user accounts in Exchange 2007. The required elements for doing that include a UserPrincipalName which would be a unique email address.
For some reason the email addresses are not being accepted. I have tried converting the variable to string using:
My code to create the mailbox is:
The reason I am using Excel instead of a CSV is because I need to edit the excel file while manipulating the user object. I know that my variable $intRow is processing to increment the row numbers in Excel just fine due to the fact that it is recording the failed attempts to create the users.
Does anyone know if there is anything special I need to do to read an email address from Excel and have it be treated as plain text? If so what changes do I need to make for that?
Thank you.
For some reason the email addresses are not being accepted. I have tried converting the variable to string using:
Code:
$email = $excel.Cells.Item($intRow,5)
$email = [string] $email
My code to create the mailbox is:
Code:
new-mailbox `
-UserPrincipalName $email `
-Password $pass `
-Database $Database `
-OrganizationalUnit $ou `
-ResetPasswordOnNextLogon $True
The reason I am using Excel instead of a CSV is because I need to edit the excel file while manipulating the user object. I know that my variable $intRow is processing to increment the row numbers in Excel just fine due to the fact that it is recording the failed attempts to create the users.
Does anyone know if there is anything special I need to do to read an email address from Excel and have it be treated as plain text? If so what changes do I need to make for that?
Thank you.