Skip to main content

Posts

Showing posts with the label PowerShell

SharePoint Prerequisites 2010/2013/2016 Update

SharePoint 2010 Prerequisites Microsoft Sync Framework Runtime v1.0 (x64) http://download.microsoft.com/download/C/9/F/C9F6B386-824B-4F9E-BD5D-F95BB254EC61/Redist/amd64/Microsoft%20Sync%20Framework/Synchronization.msi Microsoft Chart Controls for the Microsoft .NET Framework 3.5 http://download.microsoft.com/download/c/c/4/cc4dcac6-ea60-4868-a8e0-62a8510aa747/MSChart.exe Microsoft .NET Framework 3.5 Service Pack 1    http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe Windows PowerShell 2.0 http://download.microsoft.com/download/2/8/6/28686477-3242-4E96-9009-30B16BED89AF/Windows6.0-KB968930-x64.msu Windows Identity Framework (Win2008 R2) http://download.microsoft.com/download/D/7/2/D72FD747-69B6-40B7-875B-C2B40A6B2BDD/Windows6.1-KB974405-x64.msu WCF fix for Win2008 SP2 http://download.microsoft.com/download/6/8/1/681F5144-4092-489B-87E4-63F05E95079C/Windows6.0-KB976394-x64.msu WCF fix for Win2008 R2 http://download.micro...

Add-SPSolution : This solution contains one or more assemblies targeted for the global assembly cache

Exception Add-SPSolution : This solution contains one or more assemblies targeted for the global assembly cache. You should use a strong name for any assembly that will be in the global assembly cache. At line:1 char:1 + Add-SPSolution + ~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Share...dletAddSolution:   SPCmdletAddSolution) [Add-SPSolution], SPException + FullyQualifiedErrorId :Microsoft.SharePoint.PowerShell.SPCmdletAddSolutIon   I have encountered this error when I deploy my SharePoint solution (wsp) to SharePoint farm as a global assembly. This error is due to not singing the project before deploy. Solution: Go to project properties of the SharePoint project. Then select an existing signing key or create a new one to sign and build the project. Now you can Build the project again and try using Add-SPSolution, which should work fine.

Add-SPSolution : Operation is not valid due to the current state of the object.

Add-SPSolution : Operation is not valid due to the current state of the object. At line:1 char:1 + Add-SPSolution + ~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Share...dletAddSolution: SPCmdletAddSolution) [Add-SPSolution], InvalidOperationException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletAddSolut Ion I have received this error when I’m trying to deploy an .wsp file to the SharePoint farm using PowerShell Scripts. It’s kind of unusual the error I have got but IIS reset Solved my problem.

SharePoint Search Service 2013 Error

There are some common SharePoint Search Service Application erros which you might encountered when you are wokring with the service. Administrative status     Paused for:Index reset Administrative status     Paused for:External request, Index reset Administrative status     Paused for:External request You may find these erros when you navigate to Central Administration and Manage service applications then Search Service Application you can find service error details in the Search Service Application: Search Administration page Common Resolution for Those problems If you see those erros first you can do a quick workround and see whether its resolved. Stop following services in all nodes in the farm. (actually this is needed for notes which search components are running , but if you couldnt find those do it for all servers) You can goto servics by type services.msc in run window (Windows + R) Stop “SharePoi...

Request failed. The method "GetItems" of the type "List" with id is blocked by the administrator on the server. SharePoint 2013

I have encountered this issue with my SharePoint 2013 server farm. Code was working fine with the development machine but once it deployed to Share Point 2013 production environment; found this error on Chrome console. function somefunc() { listItems = '' ; var context = SP.ClientContext.get_current(); var web = context.get_web(); var currentList = web.get_lists().getById(_spPageContextInfo.pageListId); var query = new SP.CamlQuery(); listItems = currentList.getItems(); context.load(listItems); context.executeQueryAsync(onQuerySucceeded, onQueryFailed); } Message was straight forward so I thought it is a permission issue. When I logged using my credentials It was fine and worked but when I logged out and view as a Anonymous user it didn’t work. Then I tried to give permission to EveryOne to  the list , web even for the site collection and it didn’t work either. then I found out it’s a property in web applicat...

Restore Site Collection in SharePoint 2013

I have been difficult situation that i accidently delete a SharePoint site collection and create a site collection in a same URL. As i created a site collection in a same URL i thought  it can not be restored. But there is a power shell command which saved my ass. First you need to run Get-SPDeletedSite command to find out GUID of the deleted site. Now you can take the SiteId of the deleted site. Reference: http://technet.microsoft.com/en-us/library/hh286316.aspx Then you need to make sure no site is available in the restore path Then execute the following command to restore the site collection. Restore-SPSite –Identity SiteId Reference: http://technet.microsoft.com/en-us/library/ff607788.aspx

SharePoint 2013 Maintenance Notification

SharePoint 2013 contains a SPMaintenaceWindow class which can use to give notifications to end users scoped to SharePoint content database. This is a simple PowerShell script you need to execute. Ex:- Enable Notification $maintenanceStartDate = "11/29/2013 08:00:00 AM" # Date when the maintenance will start $maintenanceEndDate = "11/30/2013 02:00:00 PM" # Date when the maintenance will stop $notificationStartDate = "11/28/2013 06:00:00 AM" # Date when the message will start being displayed $notificationEndDate = "11/30/2013 02:00:00 PM" # Date when the message will stop being displayed $maintenanceLink = "" # This link will only appear if the maintenance duration is defined. $maintenanceType = "MaintenancePlanned" # OPTIONS ARE: MaintenancePlanned | MaintenanceWarning $readOnlyDays = 1 # duration days $readOnlyHours = 6 # duration hours. $readOnlyMinutes...

Format Text Out as a Table (Format-Table) in Power Shell

Format-Table in a powerful command that you can use to format your output. output can be a console or a file out. Format-Table working with object or a object collection. For an example If you have a object collection from your code you can out put as a table. Get-SPSite -Limit All | Format-Table –AutoSize -AutoSize will be use to format columns with depending of screen size. But if you are working with long width tables you better use Out-String -Width 4000 with output pipe. (4000 is a character count in horizontal, You can mention any suitable value ) Ex:- Get-SPSite -Limit All| Format-Table –AutoSize | Out-String -Width 4000 You can use Format-Table with a single object as well. Ex:- With all columns   $objAverage = New-Object System.Object $objAverage | Add-Member -type NoteProperty -name Col1 -value "saman" $objAverage | Add-Member -type NoteProperty -Name Col2 -Value 23423   $objAverage | Format-Table –AutoSize Ex:- With mentioned columns $objAverage = New-Obje...

Get SharePoint Feature by Name and Execute for all site collections

This is a simple script for day today works :) This script will find a feature that contains name like “OpenIn” and activate for entire site collections. Enable Feature for All Site Collections $feature = Get -SPFeature | where { $_.DisplayName - like "*OpenIn*" }   $featureId = $feature.Id Get -SPSite -limit ALL |foreach{ Enable-SPFeature $featureId -url $_.URL -confirm:$ false } This script will find a feature that contains name like “OpenIn” and deactivate for entire site collections. Disable Feature for All Site Collections $feature = Get -SPFeature | where { $_.DisplayName - like "*OpenIn*" }   $featureId = $feature.Id Get -SPSite -limit ALL |foreach{ Disable-SPFeature $featureId -url $_.URL -confirm:$ false }

How to do SharePoint 2010 Content Deployment

There are many articles in the web by describing Content Deployment in SharePoint 2010. But most of the time ( In my case it do not work fine always in first time :-( )  it is not working property and giving plenty of errors which direct us to restoring the backup rather than trying Content Deployment in the SharePoint Server. Here I'm going to my experiences and how I'm resolving those errors and little bit of background about the  SharePoint Content Deployment. Luckily i have manage to successfully proceed with the SharePoint Content Deployment most of the time. What is SharePoint Content Deployment   Content deploy can be use to export (deploy) content from one site collection to another site collection. content deployment is taking care of following contents in the source site collection. Web pages – Deploy corresponding images styles , master pages and etc. libraries lists resources Content Deployment do not deploy programs assemblies features ...