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