Friday, April 17, 2020

Check PnP PowerShell Module



Looking for PnP PowerShell module presence could be a valuable check for your script, below simple code will accomplish just that.


#(-)_.Check PnP OnLine Module
$module = 'SharePointPnPPowerShellOnline'
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

Microsoft M365 F3 licensing Limitations and Confusion

  If you are working in regulated environment you could be dealing with F3 license for some of your users and I am sure you have read MS lic...