Friday, April 17, 2020

PowerShell Check SharePoint Online Module;


PowerShell Check  SharePoint Online Module;
Checking SharePoint Online PowerShell module presence could be valuable check for your script, below simple code will accomplish just that.


#(-)_.Check SP/Online Module Import
 $module = 'Microsoft.Online.SharePoint.PowerShell'
if (!(Get-Module $module))
{
  write-Host "Cannot locate ($module)"
  write-host 'Script will stop' -ForegroundColor DarkCyan
  Start-Sleep -Seconds 5
  break;
}else{

 write-Host "Importing module :$module" -ForegroundColor DarkYellow
 Import-Module $module | Out-Null
 write-Host "()_.Completed" -ForegroundColor DarkYellow

}




Azure Solutions Architect
AWS Certified Cloud Practitioner
Azure Certified Security Engineer Associate




No comments:

Post a Comment