When a PowerShell script works for one person, but not for another, sometimes it's because the PowerShell module is a different version.
To find the version number:
Get-Module -ListAvailable "Microsoft.Online.SharePoint.PowerShell" |
select name, version
If you need to deal with multiple versions in your scripts:
if ( (Get-Module -ListAvailable "Microsoft.Online.SharePoint.PowerShell").
Version.ToString() -eq "16.0.4915.0")
{ … do this }
else
{ … do this }
or maybe
if ( (Get-Module -ListAvailable "Microsoft.Online.SharePoint.PowerShell")..
Version.ToString() –lt "16.0.4915.0")
{ "Must have 16.0.4915.0 or later"; Return; }
No comments:
Post a Comment