Skip to main content

Posts

Showing posts from July, 2019

Get all the users per SharePoint Group in a SharePoint Online Site

$host.Runspace.ThreadOptions = "ReuseThread" #Definition of the function that gets all the site collections information in a SharePoint Online tenant function Get-SPOSharePointUsersPerGroup {     param ($sSPOAdminCenterUrl,$sSiteUrl,$sUserName,$sPassword)     try     {            Write-Host "--------------------------------------------------------------------------------"  -foregroundcolor Green         Write-Host "Getting all Users per Group in a SharePoint Online Site" -foregroundcolor Green         Write-Host "--------------------------------------------------------------------------------"  -foregroundcolor Green            $msolcred = Get-Credential -UserName $sUserName -Message $sMessage         Connect-SPOService -Url $sSPOAdminCenterUrl -Credential $msolcred         $spoGroups=Get-SPOSiteG...

Get All Users and Groups using Powershell in Sharepoint Online Site

#Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"   #Set Variables for Site URL $SiteURL= "https://SharepointSiteCollectionURL/" #Setup Credentials to connect $Cred = Get-Credential $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) Try {     #Setup the context     $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)     $Ctx.Credentials = $Cred     #Get all Groups     $Groups=$Ctx.Web.SiteGroups     $Ctx.Load($Groups)     $Ctx.ExecuteQuery()     #Get Each member from the Group     Foreach($Group in $Groups)     {         Write-H...