Showing posts with label Powershell Script. Show all posts
Showing posts with label Powershell Script. Show all posts

Thursday, March 16, 2017

16 Mar

sharepoint Powershell migrate users in a web application

[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...

Monday, February 27, 2017

27 Feb

PowerShell - Event Receivers on SharePoint List

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

SharePoint 2010 - PowerShell Content Database Backup

“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

Delete all files & folders from SharePoint library

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

24 Oct

Fast Site Creation in SharePoint 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

How to move Child Subsite to another site collection using PowerShell

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

How to get attachments from SharePoint list with PowerShell?

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

How to enable the officewebapps in Sharepoint 2013 using Powershell Script

Get-OfficeWebAppsFarm Powershell Script $owaFarm = Get-OfficeWebAppsFarm; $owaFarm .OpenFromUrlEnabled = $tru...

Tuesday, July 19, 2016

19 Jul

Find all users who have not added a picture to their Mysite Profile

[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

WSP gets stuck in "Deploying"

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 subsite and Site Collection in SharePoint power shell script

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 moved to site Collection Using PowerShell

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

How to get all default values for a document library

$FieldName = $list.Fields["NH Department"] Write-Output $("NH Department - Default Value " + $FieldName.DefaultValu...

Monday, March 7, 2016

07 Mar

How to get specific sub sites Using Get-SPWeb object

$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

How to know List installed products & components using powershell

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

How to create site collections using SharePoint PowerShell 2013

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

Restore List Items from Recycle bin using Powershell Script by having item Guid

$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

19 Feb

Import\ Export SharePoint Subsite or SPWeb Using Powershell

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

15 Feb

SharePoint Auditing logs?

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, Update and install WSP in SharePoint using PowerShell Script

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...