[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges({param([string]$url = "http://sharepointsite/", `[string]$oldprovider = `"keystoneuser", `[string]$newprovider = `"i:0ǵ.t|keystone sts|radiant\")add-pssnapin microsoft.sharepoint.powershell -EA 0# Get all of the users in a site#$users = get-spuser -web $url...
Showing posts with label Powershell Script. Show all posts
Showing posts with label Powershell Script. Show all posts
Thursday, March 16, 2017
Monday, February 27, 2017
There are times when you want to check which event receivers are attached to a SharePoint list. This can be easily achieved through use of a PowerShell script.
$spWeb = Get-SPWeb Identity http://sharepoint$spList = $spWeb.Lists["My List"] $spList.EventReceivers | Select Name,...
27
Feb
“This post details the steps for backing up the content database of a SharePoint site through PowerShell. view the steps for backing up a content database through Central Administration.”
PowerShell provides a means to backup data within SharePoint through the following command:
Backup-SPFarm -Directory...
Friday, December 2, 2016
02
Dec
Add-PSSnapin Microsoft.SharePoint.PowerShell
# Replace siteurl with actual web url
$web = Get-SPWeb -Identity "siteurl"
# Replace docurl with document library url
$list = $web.GetList("docurl")
function DeleteFiles {
param($folderUrl)
$folder = $web.GetFolder($folderUrl)
foreach...
Monday, October 24, 2016
Fast Site Collection Creation for a template,
Enable-SPWebTemplateForSiteMaster -Template “STS#0” -CompatibilityLevel 15
Let’s get the DB where we have already provisioned a site collection.
$DB = Get-SPContentDatabase -site http://peakfinders/sites/fast
Now lets create a SiteMaster in it.
New-SPSiteMaster...
Wednesday, September 21, 2016
21
Sep
Add SharePoint snapin
Add-PSSnapin Microsoft.SharePoint.PowerShell –ea SilentlyContinue
Set variables - FYI exportfolder will throw an error if folder is already created.
$exportfolder = "E:\backup\NAME" $exportfile = "\s.cmp" $exportsite = "http://test/hr/site 101" $exportlocation = $exportfolder+$exportfile $importlocation...
Friday, September 16, 2016
16
Sep
SharePoint 2013 it works
$webUrl = "http://peakfinder/"
$library = "Product Information"
$spSite = new-object Microsoft.SharePoint.SPSite($webUrl)
$w = $spSite.OpenWeb()
$l = $w.Lists[$library]
$resultHashtable = @{}
foreach ($listItem in $l.Items)
{
Write-Host " ...
16
Sep
Get-OfficeWebAppsFarm
Powershell Script
$owaFarm = Get-OfficeWebAppsFarm;
$owaFarm .OpenFromUrlEnabled = $tru...
Tuesday, July 19, 2016
19
Jul
[void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server") | out-null
$site=new-object Microsoft.SharePoint.SPSite("https://peakfinders") #Central Admin site
$servercontext=[Microsoft.Office.Server.ServerContext]::GetContext($site)
$site.Dispose() # clean up
$upm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($servercontext)
$pc...
Thursday, March 17, 2016
17
Mar
stsadm -o execadmsvcjobs on the server running Central Admin
Install-SPSolution has only the -Force,
Check for Sharepoint 2013 Timer service
Add-SPSolution –LiteralPath "d:solution.wsp"
install solution and we executed the following command:
Install-SPSolution -Identity "solution.wsp"...
17
Mar
Import the subsite
STSADM:
stsadm -o import -url "http://sharepointsite/sites/order/" -filename D:\backup.cmp -includeusersecurity -versions 4
Powershell:
Add-pssnapin microsoft.sharepoint.powershell
Export-SPWeb -identity "http://sharepointsite/sites/order/" -path D:\backup.cmp -includeusersecurity ...
17
Mar
Export the subsite
STSADM:
stsadm -o export -url "http://sharepointsite/sites/order/" -filename D:\backup.cmp -includeusersecurity -versions 4
Powershell:
Add-pssnapin microsoft.sharepoint.powershell
Import-SPWeb -identity "http://sharepointsite/sites/order/" -path D:\backup.cmp -includeusersecurity &nb...
Tuesday, March 15, 2016
15
Mar
$FieldName = $list.Fields["NH Department"]
Write-Output $("NH Department - Default Value " + $FieldName.DefaultValu...
Monday, March 7, 2016
$WepApp = "http://peakfinderspowe/"
$site = Get-SPSite $WepApp
$array = @("Title of the First Site", "Title of the Second Site")
$filteredWebs = $site | Get-SPWeb | ? {$array -contains $_.Titl...
07
Mar
SharePoint products using PowerShell,
$listApps=Get-WmiObject -Class Win32_Product | Where {$_.IdentifyingNumber -like “*90150000-*”}
$listApps | Sort -Property Name | ft -Autosize
Central Admin. Simply navigate to your SharePoint Central Administration site and on the main page under Upgrade and Migration, click...
Wednesday, March 2, 2016
02
Mar
Declare variable for template:
$template = Get-SPWebTemplate "STS#0"
New-SPSite -Name "VSPServer Intranet" -Url "http://peakfinders" –HostHeaderWebApplication $hnscWebApp -Template $template -OwnerAlias "Peakfinder\admi...
Tuesday, February 23, 2016
23
Feb
$site = Get-SPSite http://server/sites/site
$site.RecycleBin.Restore($DeletedItem)
restore a collection of items
Assuming $DeletedItems is a collection of GUIDs:
ForEach ($deletedGuid in $DeletedItems)
{
$site.RecycleBin.Restore($deletedGuid) ...
Friday, February 19, 2016
In this article,
Run PowerShell as Administrator.
Export Subsite:
export-spweb -identity "http://peakfinders/dara" -path D:\sitebackup.cmp -includeusersecurity
Import Subsite:
import-spweb -identity "http://peakfinders/dara1" -path D:\sitebackup.cmp -includeusersecurity &nbs...
Monday, February 15, 2016
Site Settings –> Site Collection Administration,
There was no link avaliable in to "View Audit Logs"
When we creating the following templates were used to create the default site:
Document Workspace
Wiki
Blog
Records Center
We have to run PowerShell script for this enable below mention script:
stsadm...
Saturday, February 13, 2016
13
Feb
Add WSP using the following power shell script
$wspname="C:\\name.wsp"
Add-SPSolution -Identity wspname
Upgrade a WSP using the following power shell script.
(Update-SPSolution -Identity wspname -LiteralPath Physicalpath -GACDeployment)Update-SPSolution -Identity ListDefinition.wsp -LiteralPath
C:\\name.wsp -GACDeployment Install...