Get-Site
SharePoint Online: Gets sites
#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell
[CmdletBinding()]
Param([string]$Url)
Process {
try {
$cmdArgs = @{ ErrorAction = 'Stop' }
if (-not [System.String]::IsNullOrWhiteSpace($Url)) { $cmdArgs.Add('Identity', $Url) }
$result = Get-SPOSite @cmdArgs | Select-Object *
if ($null -ne $result) { foreach ($i in $result) { $i | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force } }
}
catch { throw }
}Optional site URL to retrieve