User Profile
JernejP
Joined 5 years ago
User Widgets
Recent Discussions
Using PowerShell to create 15k accounts and email account data
Hi, We have a project where we will have to create 15000 new user accounts. I will get the information for the users (such as first name, last name, and email address where to send account info) in a CSV file. I figure out the account creation part (and licensing), but I'm a bit stuck when it comes to emailing them. First - I'm assuming sending 15k emails will hit some limits, and I don't want to get our domain blacklisted. Is there a way to queue them, and have the sever send them in chunks? Second - I can't seem to be able to send emails at all. This is the code I have currently: # Get the credential $UserName = "account@domain.com" $PWord = ConvertTo-SecureString -String "myPassword" -AsPlainText -Force $credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName, $PWord ## Define the Send-MailMessage parameters $mailParams = @{ SmtpServer = 'smtp.office365.com' Port = '587' UseSSL = $true Credential = $credentials From = 'account@domain.com' To = 'myEmail@email.com' Subject = "Sending: $(Get-Date -Format g)" Body = 'This is a test email' DeliveryNotificationOption = 'OnFailure', 'OnSuccess' } ## Send the message Send-MailMessage @mailParams But I keep getting the following error: Send-MailMessage : Unable to read data from the transport connection: net_io_connectionclosed. At C:\SMail.ps1:21 char:1 + Send-MailMessage @mailParams + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpException + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage Any ideas what's wrong? The username and password are correct. Thanks4.4KViews0likes7CommentsRe: Using PowerShell to create 15k accounts and email account data
Ja4ed - You're right, I checked the domain's MX records and saw that it's an on-prem server (mail.thedomain.com), and when I tried telnet, I get an error "Could not open connection to the host, on port 25: Connect failed". The same happens for port 587. How would I go about debugging this? To see why it doesn't connect? Whereas telnet to smtp.office365.com works fine.4.2KViews0likes1CommentRe: Using PowerShell to create 15k accounts and email account data
Hi ShellBlazer This gives me the following error: Exception calling "Send" with "1" argument(s): "Failure sending mail." At C:\Smail2.ps1:33 char:1 + $Smtp.Send($Message) + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SmtpException4.3KViews0likes1CommentRe: Provisioning a team with hundreds of guest users
Andrew Hodges & henryarphillips365 We would split this into multiple teams (so for example 30 teams), and all 13.000 users would be divided between them, so the 10k limit would not be reached. So the option would be to get more licenses and do Guest AD access?1.9KViews0likes2CommentsProvisioning a team with hundreds of guest users
Hi, I was wondering how would I go about provisioning a team that will have hundreds of guest users? I looked at PowerShell and School Data Sync, but it's only possible to add members within the organization. Is there a way to add 13.000 guests (in an origination with about 250 employees), without having to add them individually? It's an EDU tenant. ThanksSolved2.1KViews0likes9Comments
Groups
Recent Blog Articles
No content to show