Ever tried to modify permissions to a SharePoint site with a huge number of files in it?
You might experience something like this:
Managing permissions to a site in SharePoint Online is of course doable with PowerShell! I thought I’d quickly go through the basics.
First of all we need to download the SharePoint Online Management Shell. This can be done by following this link:
But what’s the fun in that when we can use PowerShell?
Disclaimer: This code uses a permanent link to the msi file, this might break in the future!
Invoke-WebRequest -Uri 'https://download.microsoft.com/download/0/2/E/02E7E5BA-2190-44A8-B407-BC73CA0D6B87/SharePointOnlineManagementShell_6802-1200_x64_en-us.msi' -OutFile .\SPOShell.msi $MSI = Get-Item -Path .\SPOShell.msi msiexec /i $MSI.FullName /qb $env:PSModulePath = [System.Environment]::GetEnvironmentVariable("PSModulePath","Machine") Import-Module -Name Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
When searching for users in Active Directory using PowerShell, the ActiveDirectory module is often one of the first things that comes in to mind. The module has been around for quite som time now but there is one problem that many users still stumbles on, the Filter parameter. There are basically three methods for searching after a user with Get-ADUser.
tl;dr;** This article explains how use the -Filter parameter when searching AD, if you just want the answer, skip down to the **Solution.
On november 17th, a new version of the AzureAD PowerShell module was released to the gallery. This can be found here: https://www.powershellgallery.com/packages/AzureAD/184.108.40.206
In the old MSOnline module there were two commands used to change assigned licenses to a user. First we had the Set-MsolUserLicense with the parameter ObjectID or UserPrincipalName could be combined with AddLicenses, RemoveLicenses and LicenseOptions. Secondly we had New-MsolLicenseOptions which would create a licenseoptions object.
In the new AzureAD module there still is a command called Set-AzureADUserLicense, but it has only two parametrs, ObjectId and AssignedLicenses. There is no command to create licenseoptions.
Now this can be a bit confusing for the unexperienced PowerShell user, but fear not, we’ll get to the bottom of this!