Skip to main content

Posts

Showing posts from October, 2019

Remove all users from particular Sharepoint Group

#Load SharePoint Online Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Function to remove all users from a group Function Remove-AllUserFromGroup() {   param     (         [Parameter(Mandatory=$true)] [string] $SiteURL,         [Parameter(Mandatory=$true)] [string] $GroupName     )    Try {         $Cred= Get-Credential         $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)         #Setup the context         $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)         $Ctx.Credentials = $Cred...