{"id":140,"date":"2025-01-09T10:00:45","date_gmt":"2025-01-09T10:00:45","guid":{"rendered":"https:\/\/bestosttopst.org\/blogs\/?p=140"},"modified":"2025-01-09T10:07:45","modified_gmt":"2025-01-09T10:07:45","slug":"single-or-multiple-office-365-accounts-via-powershell","status":"publish","type":"post","link":"https:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/","title":{"rendered":"Add single or multiple Office 365 accounts via PowerShell."},"content":{"rendered":"<p>Adding single or multiple accounts in Microsoft Office 365 using PowerShell involves a command line script that effectively manages user accounts. Using PowerShell, we can add users in Microsoft 365 which will automate the task and make our work faster than adding one-by-one users. Also, the PowerShell command ensures consistency and accuracy of the data by saving our precious time compared to manual entry.<\/p>\n<h1><strong>What is PowerShell<\/strong><\/h1>\n<p>PowerShell is a command line interface used to write and run scripts to automate the tasks on the computers. Using PowerShell, you can perform complex tasks effectively. This is generally used to handle large groups of data or automate repetitive tasks on computers.<\/p>\n<h2><strong>How to add a single account<\/strong><\/h2>\n<p>1: Run Windows PowerShell as an Administrator<\/p>\n<p><strong>2: Import Required Module: <\/strong>Make sure you have imported the module and contains the necessary cmdlets to manage your Microsoft 365 users and services.<\/p>\n<p>Install-Module \u00a0-Name MSOnline<\/p>\n<p>Install-Module \u2013Name AzureAD<\/p>\n<p><strong>3.Connect to MSOnline Service: <\/strong>Authenticate to the MSOnline service using your credentials.<\/p>\n<p>$credential = Get-Credential<\/p>\n<p>This command script is used to connect to the office365 admit account.<\/p>\n<p><strong>4.<\/strong>Once you&#8217;re logged into your Exchange Online mailbox, the next step is to establish a connection with the Msolservice. To do this, enter the following command:<\/p>\n<p>Connect-MsolService -Credential $UserCredential<\/p>\n<p><strong>5.<\/strong>Run this command in the PowerShell to Add a New User:<\/p>\n<p>New-MsolUser -UserPrincipalName newuser@yourdomain.com -DisplayName &#8220;User Display Name&#8221; -FirstName &#8220;User First Name&#8221; -LastName &#8220;User Last Name&#8221; -UsageLocation US -LicenseAssignment &#8220;yourdomain:ENTERPRISEPACK&#8221; -Password &#8220;StrongPassword123&#8221;<\/p>\n<h2><strong>How to add Multiple Accounts<\/strong><\/h2>\n<p><strong>\u00a0<\/strong>If you&#8217;ve got a batch of new employees and want to create their accounts all at once, PowerShell is the best tool for the job!<\/p>\n<p><strong>1.Prepare a CSV File:<\/strong><\/p>\n<ul>\n<li><strong>\u00a0<\/strong>Launch New Excel and open a new page.<\/li>\n<li>Add these headers in columns: UserPrincipalName, DisplayName, FirstName, LastName, Usage Location, License Assignment, and Password.<\/li>\n<li>Fill all the required details in the CSV file.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-146\" src=\"http:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/ExcelScreenshot-4.png\" alt=\"Excel File\" width=\"825\" height=\"143\" srcset=\"https:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/ExcelScreenshot-4.png 825w, https:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/ExcelScreenshot-4-300x52.png 300w, https:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/ExcelScreenshot-4-768x133.png 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Save this document for your computer with the file name User.csv.<\/p>\n<p><strong>2.Use a Command to Import the CSV File:<\/strong><\/p>\n<ul>\n<li>Run this command: $users = Import-Csv -Path &#8220;C:\\PathToYourFile\\users.csv&#8221; after replacing C:\\PathToYourFile\\users.csv with the path of your csv file.<\/li>\n<\/ul>\n<p><strong>3.Add All Users:<\/strong><\/p>\n<ul>\n<li>To create this account run this command.foreach ($user in $users){New-MsolUser -UserPrincipalName $user.UserPrincipalName -DisplayName $user.DisplayName -FirstName $user.FirstName -LastName $user.LastName -UsageLocation $user.UsageLocation -LicenseAssignment $user.LicenseAssignment -Password $user.Password }<\/li>\n<li>\u00a0This command processes your CSV file and sets up an account for each listed individual. Relax and let PowerShell handle everything!<\/li>\n<\/ul>\n<p><strong>4.Verify the Accounts:<\/strong><\/p>\n<ul>\n<li>Run this command to check if the accounts were created or not:<\/li>\n<\/ul>\n<p>Get-MsolUser<\/p>\n<ul>\n<li>You\u2019ll see a list of all users in Office 365.<\/li>\n<\/ul>\n<p><strong>Tips to Remember<\/strong><\/p>\n<ul>\n<li>Remember to check your details twice before submitting them so that you will stay away from errors.<\/li>\n<li>To make your security level high use a strong password.<\/li>\n<li>Allocate the proper license to ensure users can access necessary tools.<\/li>\n<li>If you find any difficulties, run Get-Help in PowerShell to access more instructions.<\/li>\n<\/ul>\n<h3><strong>Conclusion<\/strong><\/h3>\n<p>Setting up accounts or adding users to Office 365 using PowerShell is straightforward and efficient. Just follow the commands, and you&#8217;ll have accounts ready in no time. Whether you&#8217;re creating an account for a single user or an entire team, PowerShell speeds up the process, making it quick and easy. Proper practice can make you proficient at managing Office 365 accounts effortlessly!<\/p>\n<p>Also Visit: <strong><a href=\"https:\/\/bestosttopst.org\/blogs\/add-single-and-multiple-users-in-office-365\/\">Guide to Add Single and Multiple Users in Office 365<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Adding single or multiple accounts in Microsoft Office 365 using PowerShell involves a command line script that effectively manages user accounts. Using PowerShell, we can add users in Microsoft 365 which will automate the task and make our work faster than adding one-by-one users. Also, the PowerShell command ensures consistency and accuracy of the data [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":142,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-140","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Add single or multiple Office 365 accounts via PowerShell. -<\/title>\n<meta name=\"description\" content=\"Add users to Microsoft Office 365 using PowerShell. Add single or multiple users quickly and accurately while keeping account management simple and consistent.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add single or multiple Office 365 accounts via PowerShell. -\" \/>\n<meta property=\"og:description\" content=\"Add users to Microsoft Office 365 using PowerShell. Add single or multiple users quickly and accurately while keeping account management simple and consistent.\" \/>\n<meta property=\"og:url\" content=\"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-09T10:00:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-09T10:07:45+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/Add-single-or-multiple-Office-365-accounts-via-PowerShell.png\" \/>\n\t<meta property=\"og:image:width\" content=\"720\" \/>\n\t<meta property=\"og:image:height\" content=\"405\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/\",\"url\":\"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/\",\"name\":\"Add single or multiple Office 365 accounts via PowerShell. -\",\"isPartOf\":{\"@id\":\"http:\/\/bestosttopst.org\/blogs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/Add-single-or-multiple-Office-365-accounts-via-PowerShell.png\",\"datePublished\":\"2025-01-09T10:00:45+00:00\",\"dateModified\":\"2025-01-09T10:07:45+00:00\",\"author\":{\"@id\":\"http:\/\/bestosttopst.org\/blogs\/#\/schema\/person\/ff23c9c3fa82da31deda5d9cbc17c98d\"},\"description\":\"Add users to Microsoft Office 365 using PowerShell. Add single or multiple users quickly and accurately while keeping account management simple and consistent.\",\"breadcrumb\":{\"@id\":\"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/#primaryimage\",\"url\":\"https:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/Add-single-or-multiple-Office-365-accounts-via-PowerShell.png\",\"contentUrl\":\"https:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/Add-single-or-multiple-Office-365-accounts-via-PowerShell.png\",\"width\":720,\"height\":405,\"caption\":\"Add single or multiple Office 365 accounts via PowerShell\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/bestosttopst.org\/blogs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Add single or multiple Office 365 accounts via PowerShell.\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/bestosttopst.org\/blogs\/#website\",\"url\":\"http:\/\/bestosttopst.org\/blogs\/\",\"name\":\"\",\"description\":\"helpful articles for resolve users issues\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/bestosttopst.org\/blogs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/bestosttopst.org\/blogs\/#\/schema\/person\/ff23c9c3fa82da31deda5d9cbc17c98d\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/bestosttopst.org\/blogs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d44916acc045e67956b4441bb81becd1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d44916acc045e67956b4441bb81becd1?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"description\":\"Best OST to PST is a website that helps fix problems with OST files, like corruption or inaccessibility. The site also provides helpful blogs, tips, and solutions for all users, whether you\u2019re a beginner or an expert.\",\"sameAs\":[\"http:\/\/bestosttopst.org\/blogs\"],\"url\":\"https:\/\/bestosttopst.org\/blogs\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Add single or multiple Office 365 accounts via PowerShell. -","description":"Add users to Microsoft Office 365 using PowerShell. Add single or multiple users quickly and accurately while keeping account management simple and consistent.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Add single or multiple Office 365 accounts via PowerShell. -","og_description":"Add users to Microsoft Office 365 using PowerShell. Add single or multiple users quickly and accurately while keeping account management simple and consistent.","og_url":"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/","article_published_time":"2025-01-09T10:00:45+00:00","article_modified_time":"2025-01-09T10:07:45+00:00","og_image":[{"width":720,"height":405,"url":"http:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/Add-single-or-multiple-Office-365-accounts-via-PowerShell.png","type":"image\/png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/","url":"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/","name":"Add single or multiple Office 365 accounts via PowerShell. -","isPartOf":{"@id":"http:\/\/bestosttopst.org\/blogs\/#website"},"primaryImageOfPage":{"@id":"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/#primaryimage"},"image":{"@id":"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/Add-single-or-multiple-Office-365-accounts-via-PowerShell.png","datePublished":"2025-01-09T10:00:45+00:00","dateModified":"2025-01-09T10:07:45+00:00","author":{"@id":"http:\/\/bestosttopst.org\/blogs\/#\/schema\/person\/ff23c9c3fa82da31deda5d9cbc17c98d"},"description":"Add users to Microsoft Office 365 using PowerShell. Add single or multiple users quickly and accurately while keeping account management simple and consistent.","breadcrumb":{"@id":"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/#primaryimage","url":"https:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/Add-single-or-multiple-Office-365-accounts-via-PowerShell.png","contentUrl":"https:\/\/bestosttopst.org\/blogs\/wp-content\/uploads\/2025\/01\/Add-single-or-multiple-Office-365-accounts-via-PowerShell.png","width":720,"height":405,"caption":"Add single or multiple Office 365 accounts via PowerShell"},{"@type":"BreadcrumbList","@id":"http:\/\/bestosttopst.org\/blogs\/single-or-multiple-office-365-accounts-via-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/bestosttopst.org\/blogs\/"},{"@type":"ListItem","position":2,"name":"Add single or multiple Office 365 accounts via PowerShell."}]},{"@type":"WebSite","@id":"http:\/\/bestosttopst.org\/blogs\/#website","url":"http:\/\/bestosttopst.org\/blogs\/","name":"","description":"helpful articles for resolve users issues","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/bestosttopst.org\/blogs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/bestosttopst.org\/blogs\/#\/schema\/person\/ff23c9c3fa82da31deda5d9cbc17c98d","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/bestosttopst.org\/blogs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d44916acc045e67956b4441bb81becd1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d44916acc045e67956b4441bb81becd1?s=96&d=mm&r=g","caption":"admin"},"description":"Best OST to PST is a website that helps fix problems with OST files, like corruption or inaccessibility. The site also provides helpful blogs, tips, and solutions for all users, whether you\u2019re a beginner or an expert.","sameAs":["http:\/\/bestosttopst.org\/blogs"],"url":"https:\/\/bestosttopst.org\/blogs\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/posts\/140"}],"collection":[{"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/comments?post=140"}],"version-history":[{"count":1,"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/posts\/140\/revisions"}],"predecessor-version":[{"id":150,"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/posts\/140\/revisions\/150"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/media\/142"}],"wp:attachment":[{"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/media?parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/categories?post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bestosttopst.org\/blogs\/wp-json\/wp\/v2\/tags?post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}