This simple Powershell snipplet gets the SPSite site instance in Windows SharePoint Services 3.0. Script also traps the exception in case of non-existence of SharePoint
site located at $url.
function global:Get-SPSite([string]$url) { $site = $null trap [Exception] { continue; } $site = new-object Microsoft.SharePoint.SPSite($url) return $site } |
… and here is an implementation:
$site = Get-SPSite($URL) if ($site) { #your code } else { Write-Host -ForegroundColor Red "ERROR: Site $URL has not been found" } |
Nejnovější komentáře