{"id":2894,"date":"2023-03-23T15:50:01","date_gmt":"2023-03-23T15:50:01","guid":{"rendered":"https:\/\/modern-workplace.uk\/?p=2894"},"modified":"2023-03-25T08:26:20","modified_gmt":"2023-03-25T08:26:20","slug":"teams-virtual-sbc-closing-azure-network-ports-warnings-for-azureloadbalancer-and-virtualnetwork-2-2-2-2-3-2-3-2-2-2-2-2-3-2-2-3-2-3-2-2-2-3-2-2-2-4-3-2","status":"publish","type":"post","link":"https:\/\/modern-workplace.uk\/?p=2894","title":{"rendered":"Safely and Efficiently Sending New Accounts and Passwords to Multiple Users via Email"},"content":{"rendered":"\n<p>For an ongoing project I had the requirement to send information about new accounts and passwords to the users in an organization. Luckily some people on the customer&#8217;s side (namely Paul Derbyshire and Lewis Davey) had experienced a similar situation before and they had a script that I was able to customize, to create a solution based on <a rel=\"noreferrer noopener\" href=\"https:\/\/pwpush.com\/en\/pages\/about\" data-type=\"URL\" data-id=\"https:\/\/pwpush.com\/en\/pages\/about\" target=\"_blank\">pwpush.com<\/a> and the PowerShell module <a rel=\"noreferrer noopener\" href=\"https:\/\/www.powershellgallery.com\/packages\/PwPoSh\/0.2.789.560\" data-type=\"URL\" data-id=\"https:\/\/www.powershellgallery.com\/packages\/PwPoSh\/0.2.789.560\" target=\"_blank\">PwPoSh<\/a> . <\/p>\n\n\n\n<p>The solution allows to send to the users their login information and a link to pwpush.com to retrieve their password (removing the risk of sending passwords in an email).<\/p>\n\n\n\n<p>The final result will be an email looking like the one in the picture:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange10.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange10.jpg\" alt=\"\" class=\"wp-image-2895\" width=\"661\" height=\"287\" srcset=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange10.jpg 873w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange10-300x131.jpg 300w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange10-768x334.jpg 768w\" sizes=\"auto, (max-width: 661px) 100vw, 661px\" \/><\/a><\/figure>\n\n\n\n<p>When  the user opens the password link, they will have the following screen offering them to copy their password<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange11.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange11.jpg\" alt=\"\" class=\"wp-image-2896\" width=\"617\" height=\"380\" srcset=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange11.jpg 799w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange11-300x185.jpg 300w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange11-768x473.jpg 768w\" sizes=\"auto, (max-width: 617px) 100vw, 617px\" \/><\/a><\/figure>\n\n\n\n<p>Note: I had also to <a href=\"https:\/\/modern-workplace.uk\/?p=2884\" data-type=\"URL\" data-id=\"https:\/\/modern-workplace.uk\/?p=2884\">configure Exchange Online to allow SMTP AUTH<\/a> (to fix the 550 5.7.520 Access denied error).<\/p>\n\n\n\n<p>You can create your own script based on the following one (we had also MFA enrolment and we provided support via a Teams channel):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Module -Name PwPoSh\nImport-Module -Name PwPoSh\n\n#SENDER LOGIN DETAILS\n$sendermailaddress = \"Sender Email Address\"\n$senderpassword = \"Sender Password\"\n$SecurePWD = ConvertTo-SecureString -Force -AsPlainText $senderpassword\n$Credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $sendermailaddress, $SecurePWD\n\n##MESSAGE VARIABLES\n$CompanyName = \"Name of your company\"\n\n##Launch File Browser\nAdd-Type -AssemblyName System.Windows.Forms\n$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{Filter = 'CSV Files (*.CSV)|*.CSV'}\n$null = $FileBrowser.ShowDialog()\n\n##Get data from selected file and cache in var\n$UserAccCSV = $FileBrowser.FileName\n$UserAccounts = Import-Csv $UserAccCSV\n\n#foreach ( $user in $UserAccounts )\n#{\n#$user.pwpush = Publish-Password $user.password\n#}\n\n\nforeach ( $user in $UserAccounts )\n{\n    $FirstName = $user.name    \n    $EmailAddress = $user.email\n    $UserPassword = Publish-Password $user.password\n    $Recipient = $user.recipient    \n\n$Content = @'\n&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n  &lt;meta charset=\"UTF-8\"&gt;\n  &lt;title&gt;Email&lt;\/title&gt;\n  &lt;style&gt;\n    \/* Font Definitions *\/\n    @font-face {\n      font-family: \"Cambria Math\";\n      panose-1: 2 4 5 3 5 4 6 3 2 4;\n    }\n    @font-face {\n      font-family: Calibri;\n      panose-1: 2 15 5 2 2 2 4 3 2 4;\n    }\n    @font-face {\n      font-family: Tahoma;\n      panose-1: 2 11 6 4 3 5 4 4 2 4;\n    }\n    \/* Style Definitions *\/\n    body {\n      margin: 0;\n      font-family: \"Calibri\", sans-serif;\n      font-size: 11pt;\n      line-height: 1.5;\n      color: #000;\n    }\n    a:link, a:visited {\n      color: #0563C1;\n      text-decoration: underline;\n    }\n    \/* Additional Styles *\/\n    .message {\n      margin: 20px 0;\n    }\n    .message strong {\n      font-weight: bold;\n    }\n  &lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n  &lt;p&gt;Hi $FirstName,&lt;\/p&gt;\n  &lt;div class=\"message\"&gt;\n    &lt;p&gt;We have created your $CompanyName account.&lt;\/p&gt;\n    &lt;p&gt;E-mail Address: &lt;a href=\"mailto:$EmailAddress\"&gt;$EmailAddress&lt;\/a&gt;&lt;\/p&gt;\n    &lt;p&gt;E-mail Password: $UserPassword&lt;\/p&gt;\n    &lt;p&gt;&lt;strong&gt;THIS PASSWORD LINK WILL EXPIRE IN 7 DAYS - PLEASE ACTION NOW.&lt;\/strong&gt;&lt;\/p&gt;\n  &lt;\/div&gt;\n  &lt;div class=\"message\"&gt;\n    &lt;p&gt;On first sign-in, you will need to set up MFA using an authenticator app or mobile phone. As soon as you have logged in, please immediately change your password.&lt;\/p&gt;\n  &lt;\/div&gt;\n  &lt;div class=\"message\"&gt;\n    &lt;p&gt;Do not reply to this email as the mailbox is not monitored. If you have any queries, please direct them to:&lt;\/p&gt;\n    &lt;ul&gt;\n      &lt;li&gt;Email for the M365 Migration teams\u2019 channel &lt;a href=\"mailto:supportemail@yourdomain.com\"&gt;supportemail@yourdomain.com&lt;\/a&gt;&lt;\/li&gt;\n      &lt;li&gt;Or post a message in Teams in \"M365 Migration\"&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/div&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n'@\n$CWCN = $Content.Replace('$CompanyName', $CompanyName)\n$CWCNAFN = $CWCN.Replace('$FirstName', $FirstName)\n$CWCNAFNAEM = $CWCNAFN.Replace('$EmailAddress', $EmailAddress)\n$CWCNAFNAEMAP = $CWCNAFNAEM.Replace('$UserPassword', $UserPassword)\n\nSend-MailMessage -SmtpServer 'smtp.office365.com' -UseSsl -Credential $Credentials -Subject \"$CompanyName account - log in details\" -To $Recipient -From $sendermailaddress -Port 587 -BodyAsHtml $CWCNAFNAEMAP\n}<\/code><\/pre>\n\n\n\n<p>The .csv file has to contain the following fields: password,name,recipient,email (see the image below for more details)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange12.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"27\" src=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange12-1024x27.jpg\" alt=\"\" class=\"wp-image-2901\" srcset=\"https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange12-1024x27.jpg 1024w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange12-300x8.jpg 300w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange12-768x20.jpg 768w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange12-1536x40.jpg 1536w, https:\/\/modern-workplace.uk\/wp-content\/uploads\/2023\/03\/PasswordChange12.jpg 1621w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Safely and Efficiently Sending New Accounts and Passwords to Multiple Users via Email. For an ongoing project I had the requirement to send information about new accounts and passwords to the users in an organization. Luckily some people on the customer&#8217;s side (namely Paul Derbyshire and Lewis Davey) had experienced a similar situation before and they had a script for a solution based on pwpush.com and the PowerShell module PwPoSh .  The solution allows to send to the users their login information and a link to pwpush.com to retrieve their password (removing the risk of sending passwords in an email).<\/p>\n","protected":false},"author":1,"featured_media":2895,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","twitterCardType":"","cardImageID":0,"cardImage":"","cardTitle":"","cardDesc":"","cardImageAlt":"","cardPlayer":"","cardPlayerWidth":0,"cardPlayerHeight":0,"cardPlayerStream":"","cardPlayerCodec":"","footnotes":""},"categories":[810,753,757],"tags":[759,77],"class_list":["post-2894","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-810","category-microsoft365","category-office-365","tag-microsoft-365","tag-office-365"],"_links":{"self":[{"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/posts\/2894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2894"}],"version-history":[{"count":4,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/posts\/2894\/revisions"}],"predecessor-version":[{"id":2904,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/posts\/2894\/revisions\/2904"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=\/wp\/v2\/media\/2895"}],"wp:attachment":[{"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/modern-workplace.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}