Skip to main content

Posts

Showing posts from July, 2021

PowerShell - CSOM code to get SharePoint Online Sites Permission Report

#sharepoint online powershell permissions report 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"          $AdminSiteURL="https://m365x067565-admin.sharepoint.com/"   #Connect to SharePoint Online Admin Write-host "Connecting to Admin Center..." -f Yellow Connect-SPOService -url $AdminSiteURL -Credential (Get-Credential) #Get each site collection and users $Sites = Get-SPOSite -Limit ALL Foreach($Site in $Sites) { $SiteURL=$Site.Url   } #To call a non-generic method Load Function Invoke-LoadMethod() {     param(             [Microsoft.SharePoint.Client.ClientObject]$Object = $(throw "Please provide a Client Object"),             [string]$PropertyName         )    $ctx = $Object.Context    $load = [Microsoft.SharePoint.Client.Cl

Powershell Script to get Report Group-enabled SharePoint sites Get all sites with the Office 365 Group template

<# .NOTES      =========================================================================================================================================   Author: Kamal Pandey         DESCRIPTION : Report Group-enabled SharePoint sites Get all sites with the Office 365 Group template  #> $siteUrl = Read-Host  "Enter SharePoint Admin Center Url" try {     Set-ExecutionPolicy RemoteSigned     $Cred = Get-Credential     $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection     Import-Module (Import-PSSession $Session -Allowclobber) -Global      Connect-MsolService -Credential $Cred     Connect-SPOService -Url $siteUrl -credential $Cred } catch {     write-host "Failed to connect to SharePoint online site at " $siteUrl -ForegroundColor Red     write-host $_ -ForegroundColor Red     return; } # ===Start Script ========================================

Power shell Script to get External Users on Office 365

Hello Everyone,  Below is the Powershell script to get all external users from office 365 tenant. #--------------------------------------------------------------------------------------------------------------------------- $host.Runspace.ThreadOptions = "ReuseThread" #Definition of the function that gets all the external users in a SharePoint Online Tenant. function Get-SPOExternalUsers {     param ($sUserName,$sMessage,$sSPOAdminCenterUrl)     try     {             Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green         Write-Host "Getting all the external users in a SharePoint Online Tenant" -foregroundcolor Green         Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green         $msolcred = Get-Credential -UserName $sUserName -Message $sMessage         Connect-SPOService -Url $sSPOAdminCenterUrl -Credential $msolcred