Skip to main content

Posts

Showing posts from February, 2021

PS script to generate reports of the guest users last login information from the Office 365 tenant.

 Dear All,  As you know office 365/ SharePoint has a profound impact on the collaboration space where we collaborate with external users or business partner to work together sometimes we need to audit our platform such as how many guest users present on our tenant, I am posting a script that helps you to generate a report out of it.  The script is below you may copy create a PS file to run from your machine. if need any help please reach out to me at kamal_pandey@outlook.com I would be very happy to help.  <# .NOTES  DESCRIPTION: This script will generate guest users' last login information from the Office 365  tenant.  #> #Import SharePoint Online Management Shell Import-Module Microsoft.Online.Sharepoint.PowerShell -DisableNameChecking   #Config Parameters $AdminSiteURL="https://cpsgpartners-admin.sharepoint.com" $ReportOutput ="C:\Temp\ExternalUsersRpt.csv"   #Get Credentials to connect $Cred = Get-Credential   #Connect to SharePoint Online Tenant Admin

PowerShell CSOM code to export term set from SharePoint online

 #Load SharePoint CSOM 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" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Taxonomy.dll"     #Variables for Processing $AdminURL = "https://abc-admin.sharepoint.com" $ReportOutput="C:\Temp\TermStoreData.csv"   Try {     #Get Credentials to connect     $Cred = Get-Credential     $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)     Connect-SPOService -Url https://mmibi-admin.sharepoint.com #-Credential $Creds      Connect-MsolService #-Credential $Creds       #Setup the context     $Ctx = New-Object Microsoft.SharePoint.Client.ClientConte

Create multiple SharePoint site collections from .csv file

 <# .NOTES  DESCRIPTION : Using the Script SharePoint admin will be able to Create Multiple Site Collections in Bulk from a CSV File using PowerShell  #> #Config Parameters $TenantUrl = Read-Host  "Enter SharePoint tenant admin URL" $CSVPath = "C:\Temp\SiteCollections.csv" #Connect to Tenant Connect-PnPOnline -url $TenantUrl -Credentials (Get-Credential) #or -UseWebLogin for MFA   Try {     #Get Site Collections to create from a CSV file     $SiteCollections = Import-Csv -Path $CSVPath       #Loop through csv and create site collections from each row     ForEach ($Site in $SiteCollections)     {         #Get Parameters from CSV                  $Title = $Site.Title         $Url = $Site.Url         $Owner =$Site.Owner         $Template = $Site.Template         $StorageQuota = $Site.StorageQuota                   $TimeZone = $Site.TimeZone           #Check if site exists already         $SiteExists = Get-PnPTenantSite | Where {$_.Url -eq $URL}         If ($SiteE