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

Thursday, March 18, 2021

18 Mar

How to list all sites and subsites in SharePoint Online using PowerShell?

function Get-SPOWebs(){param(   $Url = $(throw "Please provide a Site Collection Url"),   $Credential = $(throw "Please provide a Credentials"))  $context = New-Object Microsoft.SharePoint.Client.ClientContext($Url)    $context.Credentials = $Credential   $web = $context.Web ...

Saturday, January 23, 2021

23 Jan

Last Modified date for site collection?

 Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.Office.Server.Search.Query”)  [String]$lastDate = "1/1/2018"foreach($sc in $webapplication | Get-SPSite -Limit All){    Write-Host $sc.Url -ForegroundColor Yellow ...

Thursday, October 6, 2016

06 Oct

Cannot update Created By (Author) field through powershell

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue $SPWeb = Get-SPWeb "http://sharepoint"; $SPList = $SPWeb.GetList("http://sharepoint/Lists/Favorites"); $userName = "i:0#.w|[domain]\[username]"; $user = Get-SPUser -web $SPWeb -Identity $userName; $SPListItem = $SPList.Items.Add(); $SPListItem["URL"] =...

Thursday, March 17, 2016

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

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

Thursday, February 18, 2016

18 Feb

Deleting all the items from a large list in SharePoint

Server Object Model: string command = String.Format("<Method><SetList Scope=\"Request\">{0}</SetList><SetVar Name=\"ID\">{{0}}</SetVar><SetVar Name=\"Cmd\">Delete</SetVar><SetVar Name=\"owsfileref\">{{1}}</SetVar></Method>", list.ID);      SPQuery...

Friday, February 12, 2016

12 Feb

How to Finding Column Display and Internal Names in Custom list using Powershell

$web = Get-SPWeb http://peakfinders $list = $web.Lists["Employee"] $list.fields | select Title, InternalName, Hidden, CanBeDeleted | sort title | ft -AutoSize As you will most often be interested in the non-hidden fields, you can add a Where to filter them: $list.fields | select Title, InternalName, Hidden, Sealed,...

Friday, January 29, 2016

29 Jan

Get all the site collection with content DB details using powershell commands

Get sites and content DB details using following power shell command $rootSite=New-Object Microsoft.SharePoint.SPSite("http://weburl")$spWebApp = $rootSite.WebApplication foreach($site in $spWebApp.Sites) {        write-output "$($site.RootWeb.Url) - $($site.ContentDatabase)"        ...

Wednesday, December 9, 2015

09 Dec

Programmatically Create SharePoint Toplink bar and Quicklaunch bar in SharePoint 2010 and 2013

Programmatically Create TopLink Bar in SharePoint site collection: SPNavigationNodeCollection topnav = oweb.Navigation.TopNavigationBar; SPNavigationNode node = new SPNavigationNode("Title", "URL"); node = topnav.AddAsLast(node); node.Update(); Similarly, To create Quicklaunch bar SPNavigationNodeCollection topnav...

Wednesday, August 5, 2015

05 Aug

Import and Export subsite in SharePoint 2013 Using PowerShell Script

 Add-PSSnapin Microsoft.SharePoint.PowerShell  Export-SPWeb "http://raghu/sites/test/test1" –Path "C:\rm.cmp" -includeusersecurity  Import-SPWeb "http://raghu/sites/test/test1" -path "C:\rm.cmp" -IncludeUserSecuri...

Tuesday, August 4, 2015

04 Aug

get SPWebTemplates Templates in SharePoint 2013

Add-PSSnapin Microsoft.SharePoint.PowerShell -ea silentlycontinue | Out-Null Get-SPWebTemplate | ft ID, name, Title, Description -autosize -wrap ...

Monday, August 3, 2015

03 Aug

What is the full form of mdf, ldf and ndf in SQL Server?

SQL Server databases have three types of files:Primary data filesThe primary data file is the starting point of the database and points to the other files in the database. Every database has one primary data file. The recommended file name extension for primary data files is .mdf.Secondary data filesSecondary data files...
03 Aug

Search Architecture Key points

Search : Level 1.web application 2.site level  1.webapplication when user creates using search center we need to config central admin 1.incremental crawl -last updated items (we can set time every half/one hour user defined)  2.full crawl -all items in web application (weekly once or day-wise...

Wednesday, July 29, 2015

29 Jul

how to remove Everyone permission for SP site and get SP users in sharepoint powershell

Add-PSSnapin Microsoft.SharePoint.PowerShell Get-SPUser -web "http://raghu:2015/" Remove-SPUser "c:0(.s|true" -web "http://raghu:2015...

Tuesday, July 21, 2015

21 Jul

How to get login user Manager In SPServices In SHarepoint 2013

<script type="text/javascript"> $(document).ready(function() { var managerName;         var userName = $().SPServices.SPGetCurrentUser();         $().SPServices({             operation: "GetUserProfileByName",        ...

Friday, July 17, 2015

17 Jul

Freeze header in SharePoint List using JQuery?

Code: Replace user list id{B7EDD228-FDD2-46D2-A47E-E33D1D27E612}-{80AB3567-18AE-4ACE-A8E5-C86E5285E9C9} <script type="text/javascript"> $(document).ready(function(){ var SummaryName ="Employee"; $("table").each(function(){   var curTable = $(this).attr('id');   if (curTable  == "{B7EDD228-FDD2-46D2-A47E-E33D1D27E612}-{80AB3567-18AE-4ACE-A8E5-C86E5285E9C9}"){ var...

Thursday, July 16, 2015

16 Jul

How to particular site collection move new content database SharePoint Powershell Script

move-spsite "http://raghuspsserver/" -DestinationDatabase "raghu_contentdbne...

Saturday, July 4, 2015

04 Jul

Do and Don't do n SharePoint Developement ,Best practices In SharePoint 2013,2010

When creating new columns, name them without any special characters or spaces.  After the column is created, rename it with the special characters or spaces.  This way the internal name is "clean". When you are working with DataViews, some third party controls, and custom Webparts - you must use the internal...

Saturday, June 27, 2015

27 Jun

SharePoint - How to Check Disk Space Usage

To determine your disk space usage: 1. Click on "Site Settings". 2. Click on "Go to site admin". 3. Click on "View Site Collection Usage Summary" - note that the maximum amounts listed may not agree with those outlined for your hosting plan. The amounts listed for your hosting plan are the correct limits. 4....