PowerShell script to create CSV file from SQL Table

In this article, we will create a CSV file from SQL Database using PowerShell script. Requirement Suppose there is a table in the SQL Server database and it contains more than 50,000 records. Now we want to create a CSV file and put all 50,000 records in this file and that should be an automatic … Read more

PowerShell Script to export SharePoint List to Excel or CSV

In this blog, I will write about “How to Export SharePoint list to a excel file?”.As you know, SharePoint list is a combination of rows and columns. It is similar to a table. There are multiple ways to export SharePoint list to excel or CSV file, in this blog I will explain about How to … Read more

Write Power Shell Script to Lock and Unloock a Site in SharePoint 2010

Below Power Shell Script will Unlock a SharePoint site if it is in locked/read-only.#Region variable declarationWrite-Host “UnLock status started…..”Add-PSSnapin Microsoft.Sharepoint.PowershellSet-SPSite -Identity “<site-url>” -LockState “Unlock”Write-Host “Task completed…..”Read-Host -Prompt “The above error occurred. Press Enter to exit.”For -LockState attribute there are mainly 4 parameters that can be used:Unlock – To unlock site collection and make it available to … Read more

PowerShell Command List used in SharePoint 2010

PowerShell Command which are common in use for a SharePoint Developer.   BackupBackup-SPSite http://oldsite -Path C:backupsitename.bak RestoreRestore-SPSite http://newsite -Path C:backupsitename.bak Add WSPAdd-SPsolution “C:File1.wsp” Update WSPUpdate-SpSolution -Identity File1.wsp -LiteralPath “C:File1.wsp” -GACDeployment Install WSPInstall-SPSolution -Identity “File.wsp”  -WebApplication “http://siteurl” EnableFeatureEnable-SPFeature -identity “MyFeature” -URL “http://siteurl” Disable FeatureDisable-SPFeature -identity “MyFeature” -URL “http://siteurl” InstallFeatureInstall-SPFeature -path “MySPFeature1” Uninstall FeatureUninstall-SPFeature -Identity “MySPFeature1” Get … Read more

Powershell Command to add a file to root of SharePoint

This blog will explain about adding a file to SharePoint root.Generally sharepoint structure is http://server/pages/page1.htmlSuppose you need to add a file in root which should access by http://server/page1.html This can be done by powershell command. Write-Host “Powershell started…..”Add-PSSnapIn Microsoft.SharePoint.PowerShell$fileBytes = [system.io.file]::ReadAllBytes(“C:myfolderpage1.html”);$site = Get-SPSite “http://server”;$site.RootWeb.Files.Add(“page1.html“, $fileBytes, $true);Write-Host “Done…”

RSS
YouTube
YouTube
Instagram