\n Hi, and welcome to the PowerShell forum! \n\n\nDon’t apologize for being a “noob” or “newbie” or “n00b.” There’s just no need – nobody will think you’re stupid, and the forums are all about asking questions. Just ask! \n\n\nUse a descriptive subject. Don’t say “Need help” or “PowerShell Help”, actually summarize what the problem is. It helps the rest of us keep track of which problem is which. \n\n\nDon’t post massive scripts. We’re all volunteers and we don’t have time to read all that, nor will we copy…\n <\/blockquote>\n<\/aside>\n\n <\/p>","upvoteCount":0,"datePublished":"2021-04-15T18:24:52.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/2","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
Is that an on-prem exchange server or exchange online?<\/p>\n
when you create a mailbox it automagically creates the AD user.<\/p>\n
so first create the mailbox, when set the values you want for the AD User.<\/p>\n
new-mailbox #stuff\nset-aduser #stuff\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2021-04-15T18:38:39.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/3","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"Ok thx, that is good point.<\/p>\n
I must dive in to the<\/p>\n
set-aduser\n<\/code><\/pre>\nso with set-adusers i can edit (fter creation of the mailbox+account) all the properties for an account?<\/p>\n
set-adusers\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2021-04-16T04:43:22.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/4","author":{"@type":"Person","name":"nvtnvt9030","url":"https://community.spiceworks.com/u/nvtnvt9030"}},{"@type":"Answer","text":"Pretty much, yeah, anything AD related<\/p>","upvoteCount":0,"datePublished":"2021-04-16T04:55:11.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/5","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
I have made a excel file with the headers and save it as a comma seperated csv.<\/p>\n
Then tried several things in powershell to import the csv, first tried several things to make new-mailboxes and second tried to make the accounts with new-aduser both things fail. The first with the error cannot bind with the argument name is null. I cannot figure out wat the error means and what is wrond with both methods. Searching online it succeeds with the most that do this but not with me…<\/p>\n
the code for the new-aduser:<\/p>\n
error: cannot validate argument on parameter ‘name’ the argument is 0 or empty.<\/p>\n
import-csv C:\\scripts\\input\\test.csv | % {New-ADUser -Name $_.displayname -SamAccountName $_.SamAccountName -DisplayName $_.displayname -Surname $_.Sn -GivenName $_.GivenName -AccountPassword (ConvertTo-SecureString Password1234 -AsPlainText -Force) -Enabled:$true -Title $_.Title -Description $_.description -ChangePasswordAtLogon:$false} | % {Enable-Mailbox -Identity $_.SamAccountName -Alias $_.SamAccountName}\n\n<\/code><\/pre>\nthis is for adding mailboxes with ad accounts. Run it on the Exchange 2013 server in Management PowerShell:<\/p>\n
csv is filled with headers like this and beneath the headers:\n<\/code><\/pre>\nName,alias,userprincipalname,organizationalunit,database,password\n\ntest12 test,testa,[email protected] ,CEO,Board,database1,Test123!\n\n$bulk = Import-CSV c:\\scripts\\input\\test.csv\nforeach ($_ in $bulk)\n{\n$name=$_.name\n$alias=$_.alias\n$upn=$_.UserPrincipalName\n$db=$_.Database\n$ou=$_.organizationalunit\n$encryptedpass = convertto-securestring $_.password -asplaintext -force\n$resetpass = $false\n\nnew-mailbox -Name $name -Alias $alias -UserPrincipalName $upn -Database $db -OrganizationalUnit $ou -Password $encryptedpass\nSet-User $_.alias -Title $_.alias\n}\n<\/code><\/pre>\nCan someone help me out here, adding accounts with email in Exchange 2013 from csv is used many times, what is wrong?<\/p>\n
Powershell version 5 (WIndows 10 machine and also run on Exchange 2013 management shell<\/p>","upvoteCount":0,"datePublished":"2021-04-17T15:44:15.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/6","author":{"@type":"Person","name":"nvtnvt9030","url":"https://community.spiceworks.com/u/nvtnvt9030"}},{"@type":"Answer","text":"\n\n
<\/div>\n
nvt7393:<\/div>\n
\nI cannot figure out wat the error means and what is wrond with both methods. Searching online it succeeds with the most that do this but not with me…<\/p>\n
the code for the new-aduser:<\/p>\n
error: cannot validate argument on parameter ‘name’ the argument is 0 or empty.<\/p>\n<\/blockquote>\n<\/aside>\n
make sure your CSV is a VALID format.<\/p>\n
\"Name\",\"alias\",\"userprincipalname\",\"organizationalunit\",\"database\",\"password\"\n\n\"test12 test\",\"testa\",\"[email protected] \",\"CEO\",\"Board\",\"database1\",\"Test123!\"\n<\/code><\/pre>\nThat space might be an issue. There can not be space or blank values in the CSV<\/p>","upvoteCount":0,"datePublished":"2021-04-17T16:30:06.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/7","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
Why are you trying to create the AD user and the mailbox separately?<\/p>\n
Creating the mailbox does create the user.<\/p>\n\n\n
<\/div>\n
nvt7393:<\/div>\n
\nadding accounts with email in Exchange 2013 from csv is used many times, what is wrong?<\/p>\n<\/blockquote>\n<\/aside>\n
do you get an error?<\/p>","upvoteCount":0,"datePublished":"2021-04-17T16:44:49.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/8","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
where do you see the space?<\/p>\n
In Excel i fill in the headers and beneath the data, then export to csv comma seperated, how to avoid spaces?<\/p>","upvoteCount":0,"datePublished":"2021-04-18T05:28:47.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/9","author":{"@type":"Person","name":"nvtnvt9030","url":"https://community.spiceworks.com/u/nvtnvt9030"}},{"@type":"Answer","text":"
Neally,<\/p>\n
I do not do both, but trying both. First one is creaating the mailboxes but that failes with the errors (when executing the .ps1):<\/p>\n
convertTo-Securestring: cannot bind argument to parameter string because it is null (password field is filled in though in the csv)<\/p>\n
cannot bind argument to parameter Name because it is an empty string<\/p>\n
parametrebinding validation exception<\/p>\n
Cannot bind argument to parameter identity bacause it is null<\/p>\n
:<\/p>","upvoteCount":0,"datePublished":"2021-04-18T05:40:46.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/10","author":{"@type":"Person","name":"nvtnvt9030","url":"https://community.spiceworks.com/u/nvtnvt9030"}},{"@type":"Answer","text":"\n\n
<\/div>\n
nvt7393:<\/div>\n
\nconvertTo-Securestring: cannot bind argument to parameter string because it is null (password field is filled in though in the csv)<\/p>\n
cannot bind argument to parameter Name because it is an empty string<\/p>\n<\/blockquote>\n<\/aside>\n
Powershell is pretty good with errors, even though you think all is good, it is telling you there is SOMETHING wrong with it.<\/p>","upvoteCount":0,"datePublished":"2021-04-18T06:36:05.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/11","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
But what to do with is, what is wrong with the commands or csv?<\/p>","upvoteCount":0,"datePublished":"2021-04-18T06:38:38.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/12","author":{"@type":"Person","name":"nvtnvt9030","url":"https://community.spiceworks.com/u/nvtnvt9030"}},{"@type":"Answer","text":"\n\n
<\/div>\n
nvt7393:<\/div>\n
\nwhere do you see the space?<\/p>\n
In Excel i fill in the headers and beneath the data, then export to csv comma seperated, how to avoid spaces?<\/p>\n<\/blockquote>\n<\/aside>\n
$csv = \n@\"\nName,alias,userprincipalname,organizationalunit,database,password\ntest12 test,testa,[email protected] ,CEO,Board,database1,Test123!\n\"@ | convertfrom-csv\n$csv\n<\/code><\/pre>\nName : test12 test\nalias : testa\nuserprincipalname : [email protected] \norganizationalunit : CEO\ndatabase : Board\npassword : database1\n<\/code><\/pre>\ni assume the password is not supposed to be ‘database1’ ?<\/p>\n
You have 6 columns, but 7 values.<\/p>","upvoteCount":0,"datePublished":"2021-04-18T06:39:04.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/13","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
i don’t have exchange to test, but maybe try like so<\/p>\n
$csv = \n@\"\nName,alias,userprincipalname,organizationalunit,database,password\ntest12 test,testa,[email protected] ,CEO,database1,Test123!\n\"@ | convertfrom-csv\n$csv\n\nforeach ($row in $csv) {\n $newMailbox = @{\n Name = $row.name \n Alias = $row.alias \n UserPrincipalName = $row.userprincipalname \n Database = $row.database \n OrganizationalUnit = $row.organizationalunit \n Password = convertto-securestring $row.password -asplaintext -force\n }\n try {\n new-mailbox @newMailbox -erroraction stop\n Set-ADUser -identity $row.alias -Title $row.organizationalunit\n }\n catch {\n $error[0].exception.message\n }\n}\n\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2021-04-18T06:40:17.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/14","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"It is atypo, in real there are 6 rows…<\/p>","upvoteCount":0,"datePublished":"2021-04-18T07:32:40.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/15","author":{"@type":"Person","name":"nvtnvt9030","url":"https://community.spiceworks.com/u/nvtnvt9030"}},{"@type":"Answer","text":"
What do you mean with this,<\/p>\n
$csv = \n@\"\nName,alias,userprincipalname,organizationalunit,database,password\ntest12 test,testa,[email protected] ,CEO,database1,Test123!\n\"@ | convertfrom-csv\n$csv\n\nforeach ($row in $csv) {\n $newMailbox = @{\n Name = $row.name \n Alias = $row.alias \n UserPrincipalName = $row.userprincipalname \n Database = $row.database \n OrganizationalUnit = $row.organizationalunit \n Password = convertto-securestring $row.password -asplaintext -force\n }\n try {\n new-mailbox @newMailbox -erroraction stop\n Set-ADUser -identity $row.alias -Title $row.organizationalunit\n }\n catch {\n $error[0].exception.message\n }\n}\n<\/code><\/pre>\nnot make use of the csv file?<\/p>","upvoteCount":0,"datePublished":"2021-04-18T07:33:36.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/16","author":{"@type":"Person","name":"nvtnvt9030","url":"https://community.spiceworks.com/u/nvtnvt9030"}},{"@type":"Answer","text":"\n\n
<\/div>\n
nvt7393:<\/div>\n
\nWhat do you mean with this, not make use of the csv file?<\/p>\n<\/blockquote>\n<\/aside>\n
typos are an issues<\/p>\n
I have no idea what you mean.<\/p>","upvoteCount":0,"datePublished":"2021-04-18T07:34:30.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/17","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
I have run this and looks like it is doiing something. I saw that i used a database on a Exchange 2010 server, so changed the database and the password because it was not meeting the requerements.<\/p>\n
It shows me a screen after running but at the end the message is:<\/p>\n
\"cannot find an object with the identitiy ‘testa’ under doman.local.<\/p>\n
It is not red colored so this is not an error?<\/p>\n
Why is this running but not when the csv is filled, i must change the database though to test if that is also working now and whaat does the last message mean?<\/p>\n
I has created the account though test12test as displayname.<\/p>","upvoteCount":0,"datePublished":"2021-04-18T07:49:54.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/18","author":{"@type":"Person","name":"nvtnvt9030","url":"https://community.spiceworks.com/u/nvtnvt9030"}},{"@type":"Answer","text":"\n\n
<\/div>\n
nvt7393:<\/div>\n
\nWhy is this running but not when the csv is filled<\/p>\n<\/blockquote>\n<\/aside>\n
Since this is ‘manually’ creating the CSV, my best guess is that there is something wrong with your CSV file.<\/p>\n\n\n
<\/div>\n
nvt7393:<\/div>\n
\n\"cannot find an object with the identitiy ‘testa’ under doman.local.<\/p>\n<\/blockquote>\n<\/aside>\n
I assume that might come from ‘set-aduser’ ? \nCheck if<\/p>\n
\nthe mailbox was created<\/li>\n if the AD user was created<\/li>\n what the samaccount name is, if it was created<\/li>\n<\/ol>","upvoteCount":0,"datePublished":"2021-04-18T07:53:33.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/19","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"\n\n
<\/div>\n
nvt7393:<\/div>\n
\nIt is not red colored so this is not an error?<\/p>\n<\/blockquote>\n<\/aside>\n
just because it is red does not mean it is an error, same thing reverse, just because it is NOT read does not mean it is not an error.<\/p>\n
don’t worry about the color but the message, it says there is no object with that identity found, so check if it exists or not, or possibly with a different name.<\/p>\n
we have no access to your system, we do not see what you see, so we only know what you tell us. and it seems things are changing and you are changing things without telling us, so we have no clue, we can’t read minds.<\/p>","upvoteCount":0,"datePublished":"2021-04-18T07:57:42.000Z","url":"https://community.spiceworks.com/t/create-emailadresses-for-webmail/797017/20","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}}]}}
Neally
(Neally)
April 15, 2021, 6:24pm
2
If you post code, please use the ‘Insert Code’ button. Please and thank you!
Hi, and welcome to the PowerShell forum!
Don’t apologize for being a “noob” or “newbie” or “n00b.” There’s just no need – nobody will think you’re stupid, and the forums are all about asking questions. Just ask!
Use a descriptive subject. Don’t say “Need help” or “PowerShell Help”, actually summarize what the problem is. It helps the rest of us keep track of which problem is which.
Don’t post massive scripts. We’re all volunteers and we don’t have time to read all that, nor will we copy…