Slow Office 365 admin portal issues? Try PowerShell

0

Frustrated by slow responses from the Office 365 admin center? A switch to PowerShell can speed up the execution of management tasks for a better administrative experience.

Microsoft continues to expand the number of improvements and new features to Office 365, constantly revamping the admin portal. Administrators should be vigilant to find new screens and options in the portal to manage the security, compliance, and administration of all Office 365 services. Rather than browsing the many pages to perform recurring tasks through a browser, PowerShell scripts can be the best tool to support a more efficient and automated approach.

The changes to the web-based management console exceed the available study guides, forcing many admins to turn to video tutorials, blog posts, and explore the site to learn how to use the new management functionality. Admins will find that they can use PowerShell scripts to handle most of their day-to-day administrative tasks – in some cases with even more functionality than the admin center. There are times when the admin portal is slow to respond, which makes PowerShell another option if an urgent project needs quick attention.

Areas where PowerShell outperforms the admin center

PowerShell is Microsoft’s command-line shell scripting language designed to help administrators who manage and configure Microsoft products and services. It is capable of small tasks, such as sending a restart command to a remote server or extracting a list of unlicensed users from the Office 365 platform.

PowerShell is ideally suited for a range of repetitive tasks that are not suited to running from the admin portal. Some of these activities include obtaining a list of licensed users with disabled accounts, generating a list of users with multi-factor authentication enabled, disabling multiple accounts, or deleting a site. SharePoint with multiple subsites.

How to turn off access to the Office 365 portal

Restricting account access to the administrative portal area can be done in Active Directory. The changes will sync with Office 365 to deactivate these accounts, but some tenants may want to keep certain accounts in Active Directory while deactivating their connection to Office 365.

To disable login for a large list of users from the web portal, you need to make changes from the active users section. The administrator selects one name at a time from the grid. Depending on the size of the list, this task can take a long time.

The method of manually selecting users in the Admin Portal to change their login status is a slow process.

Then select the change the connection state option. The web administration portal does not allow searching for additional users after this selection process. To disable multiple names at once, you need to scroll down and visually search for the name, not by keyword. This limit makes it almost unusable for large corporate accounts.

PowerShell doesn’t have the downsides of the admin portal. There is no limitation to search for users by name. The following PowerShell script reads the list of users to edit and then performs the action on each of the email addresses or accounts listed in the file.

Get-Content “C: My Documents Accounts.txt” | ForEach {Set-MsolUser -UserPrincipalName $ _ -BlockCredential $ true}

The automation aspect of PowerShell means that this script can be triggered manually or scheduled to run periodically.

Remove parent sites that contain subsites in SharePoint Online

PowerShell is a better management choice than Admin Portal when it’s time to delete a SharePoint site with multiple subsites.

From the web portal, an administrator will need to delete all subsites manually before the parent site can be deleted, otherwise the system will generate an error message. This may require a lot of manual effort depending on the number of subsites involved.

The PowerShell method can dramatically reduce this SharePoint work by having a script that reads all of the subsites under a parent site and then automatically deletes all of those discovered subsites before deleting the parent site. This approach requires the administrator to enter a few parameters interactively, including their credentials, the administration portal URL, and the site to be deleted.

function remove-SPOWeb ($web){
 #Uses the to be deleted variable as start point
 $context = New-Object Microsoft.SharePoint.Client.ClientContext($web)   
 $context.Credentials = $SPOCredentials
 $web = $context.Web 
 $context.Load($web)
 $context.Load($web.Webs)
 #send the request containing all operations to the server

 try{
  $context.executeQuery()
#remove any subweb if present
  if ($web.Webs.Count -ne 0){
   foreach ($subweb in $web.Webs){
    remove-SPOWeb($subweb.url)
   }
  }

Write-Host "Info: Removing $($web.url)" -foregroundcolor green
  $web.DeleteObject()
  $Context.ExecuteQuery()
 }
 catch{
  write-host "Error: $($_.Exception.Message)" -foregroundcolor green
 }
}
function remove-SPOWebs{
#variables that needs to be set before starting the script
$userName = "[email protected]"
$adminUrl = "https://TenantName-admin.sharepoint.com"

# Let the user fill in the site that has to be deleted
$toBeDeleted = Read-Host "Please enter the full url of the site that needs to be deleted (e.g. https://TenantName.sharepoint.com/sites/rootsite/subsite"

# Let the user fill in their password in the PowerShell window
$password = Read-Host "Please enter the password for $($userName)" -AsSecureString

# set SharePoint Online and Office 365 credentials
$SPOCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $password)
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $password

#connect to to Office 365
try{
Connect-SPOService -Url $adminUrl -Credential $credentials
write-host "Info: Connected succesfully to Office 365" -foregroundcolor green
}
catch{
write-host "Error: $($_.Exception.Message)" -foregroundcolor red
Break delete-SPOSites
}

#verify if site already exists in SharePoint Online
$siteExists = get-sposite | where{$_.url -eq $toBeDeleted}
#remove web if site isn't an site collection
if ($siteExists -eq $null) {
remove-SPOWeb($toBeDeleted)
}
else {
Remove-SPOSite -Identity $siteExists -NoWait -confirm$false
write-host "Info: The site collection $($toBeDeleted) has been removed" -foregroundcolor green
}
}
remove-SPOWebs

PowerShell excels at creating reports in Office 365

Another area where the Microsoft 365 admin center is more limited than PowerShell points out.

The reports section of the portal is limited to productivity score and usage, making it difficult to get more granular information. There is no way to customize column names or filters. For advanced reporting, PowerShell provides many more output options by accessing audit logs on all Office 365 services.

Exchange Online PowerShell commands, especially those in Microsoft’s Exchange Online PowerShell V2 module, perform mass tasks and activities very quickly, even when processing thousands of mailboxes. The capabilities of PowerShell make it possible to quickly make changes that would require a lot of time and effort on the part of the Exchange admin web portal.

For example, when a large company changes its domain name, it will need to update the primary SMTP address for all of its users. The Exchange Administration Web Portal has the functionality to change these configurations one user at a time, but processing hundreds or thousands of accounts this way would be slow and tedious. With a PowerShell script, this same task would require minimal effort and be completed faster.

Managing Office 365 through PowerShell may be a necessity

The Office 365 admin portal is a handy tool for many ad hoc security, compliance, and service configuration tasks. But point-and-click management is impractical for some procedures, and any performance issues in the portal will make it difficult to get the job done in a significant amount of time.

For advanced activities that require much more complex steps, or when the changes involve a large number of user property changes, PowerShell is a much more robust way to handle those changes. Some functionality can only be changed through PowerShell, making it essential for Office 365 administrators to understand how to use PowerShell commands and running scripts to fully manage the platform.


Source link

Leave A Reply

Your email address will not be published.