Pages

Friday, January 3, 2014

Import-SPWeb : Cannot find an SPWeb object with Id or Url

Import-SPWeb : Cannot find an SPWeb object with Id or Url : "Your Url Here".
At line:1 char:13
+ import-spweb <<<<
    + CategoryInfo          : InvalidData: (Microsoft.Share...CmdletImportWeb:
   SPCmdletImportWeb) [Import-SPWeb], SPCmdletPipeBindException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletImportWeb

If you have run into this error. You are trying to import a site that does not exist in the current URL. This happened to me while trying to move a site from my dev environment to my production environment. You have to options

  1. You can create the site , and then import it. or,
  2. You can use stsadm -o import , and this will take care of creating the site for you.

Monday, December 16, 2013

Extract all of the Solutions from your SharePoint Farm

If you don’t have all the WSPs handy, your upgrade is not doomed. It is possible to
extract all the farm solutions from your SharePoint 2010 farm using PowerShell.
Of course it is!

Run the following PowerShell statement on a server in your SharePoint
2010 farm:

(Get-SPFarm).Solutions | ForEach-Object{
  $var = (Get-Location).Path + "\" + $_.Name;
   $_.SolutionFile.SaveAs($var)
}




Install Farm Solutions to SharePoint 


# Add all WSP files in the current direction to SharePoint
Get-ChildItem | ForEach-Object{Add-SPSolution -LiteralPath $_.Fullname}
# Deploy all solutions in the farm
Get-SPSolution | ForEach-Object {If ($_.ContainsWebApplicationResource -eq $False)
{Install-SPSolution -Identity $_ -GACDeployment}
else {Install-SPSolution -Identity $_ -AllWebApplications -GACDeployment}}

Provisioning the State Service in SharePoint 2010 and SharePoint 2013

The State Service service application is used to maintain state. This is one of those goofy .NET
developer things which is the equivalent of writing on your hand. It holds the information
temporarily while you use it and then it goes away. Some people assume this isn’t necessary but even
out-of-the-box features use it so just go ahead and provision it to save looking up the error messages
later. Because there is no GUI to do you will be using the SharePoint Management Shell.

1. At the prompt, type the following and press Enter:
New-SPStateServiceApplication -Name "State Service Application"

2. At the prompt, type the following and press Enter:
Get-SPStateServiceApplication| New-SPStateServiceApplicationProxy -defaultproxygroup

3. At the prompt, type the following and press Enter:
Get-SPStateServiceApplication| New-SPStateServiceDatabase -Name "State_Service_DB"

4. At the prompt, type the following and press Enter:
Get-spdatabase | where-object {$_.type -eq "Microsoft.Office.Server.Administration.StateDatabase"} | initialize-spstateservicedatabase


Monday, September 16, 2013

SharePoint 2010 PoweShell Update Site CSS and Logo




Are you moving from one environment to another? Or just have to change the css and site logo for a large SharePoint farm, with many top Level Site Collections. I had this happen to me about 2 weeks ago. I had to update the Top Level Sites Collections CSS, and Logo URL for 35 sites. Come in PowerShell! PowerShell is a great administration tool that can help you automate and stream line your task. I used the following script to accomplish the task I needed.



Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
$WA = Get-SPWebApplication "Web Application URL"
$Sites = $WA.Sites

foreach($Site in $Sites)
{
        foreach($web in $site.AllWebs)
        {
            Write-Host  $web.Url  "   CSS URL: "   $web.AlternateCssUrl
            
            Write-Host  $web.Url  "   Logo URL: "   $web.SiteLogoUrl
            
            $web.AlternateCssUrl = "New CSS URL"
            $web.SiteLogoUrl = "NEW Logo URL"
            $web.Update() 
            Write-Host "updated: "  $web.Url
        }
}