As we all
know there are two ways to get a GUID of a Site or Site Collection
1) Using
Powershell
2) Using Sharepoint
Central Admin
Writing this post as I had a requirement in office where I had to add some users to a Sharepoint group using a console application.
This post
explores the first method of obtaining the GUID of a site using powershell script –
Below is the Powershell Script
|
Add-PSSnapin Microsoft.Sharepoint.Powershell
Write-Host "******
Welcome to Powershell script that gives GUID of a Sharepoint Site
******"
Write-Host ""
$UserEntered = Read-Host -Prompt 'Enter the Sharepoint site with
port to get GUID (Press Enter after Pasting) '
$site = Get-SPSite $UserEntered
$siteguid = $site.id
echo $siteguid
Write-Host ""
$User = Read-Host -Prompt 'Press Enter Button to Exit'
|