Monthly Archives: February 2014

Cannot connect to SharePoint 2010 Site on the server locally – Access denied

There are two methods to work around this issue, use one of the following methods, as appropriate for your situation.

Method 1: Specify host names (Preferred method if NTLM authentication is desired)

To specify the host names that are mapped to the loopback address and can connect to Web sites on your computer, follow these steps:

  1. Set the
    DisableStrictNameChecking

    registry entry to 1. For more information about how to do this, click the following article number to view the article in the Microsoft Knowledge Base:

    281308 Connecting to SMB share on a Windows 2000-based computer or a Windows Server 2003-based computer may not work with an alias name
  2. Click Start, click Run, type regedit, and then click OK.
  3. In Registry Editor, locate and then click the following registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
  4. Right-click MSV1_0, point to New, and then click Multi-String Value.
  5. Type BackConnectionHostNames, and then press ENTER.
  6. Right-click BackConnectionHostNames, and then click Modify.
  7. In the Value data box, type the host name or the host names for the sites that are on the local computer, and then clickOK.
  8. Quit Registry Editor, and then restart the IISAdmin service.

Method 2: Disable the loopback check (less-recommended method)

The second method is to disable the loopback check by setting the DisableLoopbackCheck registry key.

To set the DisableLoopbackCheck registry key, follow these steps:

  1. Set the
    DisableStrictNameChecking

    registry entry to 1. For more information about how to do this, click the following article number to view the article in the Microsoft Knowledge Base:

    281308 Connecting to SMB share on a Windows 2000-based computer or a Windows Server 2003-based computer may not work with an alias name
  2. Click Start, click Run, type regedit, and then click OK.
  3. In Registry Editor, locate and then click the following registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
  4. Right-click Lsa, point to New, and then click DWORD Value.
  5. Type DisableLoopbackCheck, and then press ENTER.
  6. Right-click DisableLoopbackCheck, and then click Modify.
  7. In the Value data box, type 1, and then click OK.
  8. Quit Registry Editor, and then restart your computer.
Advertisements

Powershell all of subsites inherit from Parent site’s master page – SharePoint 2010

Execute the below script using powershell on the SharePoint server.

Get-SPWebApplication http://yourwebapp.com | Get-SPSite -Limit All | Get-SPWeb -Limit ALL | foreach-object{
    $_.MasterUrl = "/_catalogs/masterpage/masterurl.master"
    $_.CustomMasterUrl = "/_catalogs/masterpage/mypage.master"
    $_.Update()
}

Start and Stop SharePoint services using Powershell:

  1. Start and Stop SharePoint services using Powershell:

To Start:

$ServiceName = “Central Administration”

Get-SPServiceInstance -server spinrat2 | where-object {$_.TypeName -eq $ServiceName} | Start-SPServiceInstance -confirm:$false > $null

To Stop:

$ServiceName = “Visio Graphics Service”
Get-SPServiceInstance -server COMPUTERNAME | where-object {$_.TypeName -eq $ServiceName} | Stop-SPServiceInstance -confirm:$false > $null

SharePoint 2010, Search service stuck on status “Error Stopping”

  1. Search service stuck on status “Error Stopping”:

It is disallowed to use the Stop at the services on server page. I think it tells you that you should use topology configuration for each search service application instead. Once the “Error Stopping” state is displayed you can clear it by using:

stsadm -o osearch -action start

As Thuan says, you can restart the OSearch14 service itself (SharePoint Server Search 14). From the command prompt, I use:

net stop osearch14  facilitate

In a normal environment, the process will restart by itself.

To STOP the search Service:

stsadm -o osearch -action stop

Reference: http://social.technet.microsoft.com/Forums/sharepoint/en-US/c149a467-4072-4bdd-bee7-3225fd6054f9/sharepoint-server-search-error-stopping-?forum=sharepointadminprevious

Powershell, Identify the checkout files in sharepoint farm, SharePoint 2010

  1. Identify the checkout files in sharepoint farm:

function CheckedOutItems() {

write-host “Please enter the site url”

$url = read-host

write (“SiteURL`t” + “FileName`t” +  “CheckedOutTo`t” + “ModifiedDate`t”+”Version”)

$site = New-Object Microsoft.SharePoint.SPSite($url)

$webs = $site.AllWebs

foreach($web in $webs)

{

$listCollections = $web.Lists

foreach($list in $listCollections)

{

if ($list.BaseType.ToString() -eq “DocumentLibrary”)

{

$dList = [Microsoft.Sharepoint.SPDocumentLibrary]$list

$items = $dList.Items

$files = $dList.CheckedOutFiles

foreach($file in $files)

{

$wuse = $file.DirName.Substring($web.ServerRelativeUrl.Length)

Write ($web.Url+ “`t” + $wuse+”`/” + $file.LeafName +  “`t” + $file.CheckedOutBy.Name + “`t” + $file.TimeLastModified.ToString()+”`t” + “No Checked In Version” )

}

foreach($item in $items)

{

if ($item[“Checked Out To”] -ne $null)

{

$splitStrings = $item[“Checked Out To”].ToString().Split(‘#’)

Write ($web.Url+ “`t” + $item.Url + “`t” + $splitStrings[1].ToString() + “`t” + $item[“Modified”].ToString() +”`t” + $item[“Version”].ToString())

}

}

}

}

$web.Dispose()

}

$site.Dispose()

}

CheckedOutItems

Estimate Size of sharepoint 2010 sub-sites or parent site using PowerShell

  1. Estimate Size of sharepoint sub-sites or parent site using PowerShell:

Reference URL: http://get-spscripts.com/2010/08/check-size-of-sharepoint-2010-sites.html

function GetWebSizes ($StartWeb)
{
$web = Get-SPWeb $StartWeb
[long]$total = 0
$total += GetWebSize -Web $web
$total += GetSubWebSizes -Web $web
$totalInMb = ($total/1024)/1024
$totalInMb = “{0:N2}” -f $totalInMb
$totalInGb = (($total/1024)/1024)/1024
$totalInGb = “{0:N2}” -f $totalInGb
write-host “Total size of all sites below” $StartWeb “is” $total “Bytes,”
write-host “which is” $totalInMb “MB or” $totalInGb “GB”
$web.Dispose()
}

function GetWebSize ($Web)
{
[long]$subtotal = 0
foreach ($folder in $Web.Folders)
{
$subtotal += GetFolderSize -Folder $folder
}
write-host “Site” $Web.Title “is” $subtotal “KB”
return $subtotal
}

function GetSubWebSizes ($Web)
{
[long]$subtotal = 0
foreach ($subweb in $Web.GetSubwebsForCurrentUser())
{
[long]$webtotal = 0
foreach ($folder in $subweb.Folders)
{
$webtotal += GetFolderSize -Folder $folder
}
write-host “Site” $subweb.Title “is” $webtotal “Bytes”
$subtotal += $webtotal
$subtotal += GetSubWebSizes -Web $subweb
}
return $subtotal
}

function GetFolderSize ($Folder)
{
[long]$folderSize = 0
foreach ($file in $Folder.Files)
{
$folderSize += $file.Length;
}
foreach ($fd in $Folder.SubFolders)
{
$folderSize += GetFolderSize -Folder $fd
}
return $folderSize
}

Once you have run the script, you can call it with the following PowerShell command:

GetWebSizes -StartWeb <StartURL>

SharePoint 2010, Enable Developer Dashboard via stsadm

  1. Developer Dashboard: Used to monitor the performance of pages, webparts, database etc and by default is disabled.

Enable Developer Dashboard via stsadm:

‘On’ Mode:
stsadm -o setproperty -pn developer-dashboard -pv on

‘OnDemand’ Mode:
stsadm -o setproperty -pn developer-dashboard -pv ondemand

Disable Developer Dashboard via stsadm:
stsadm -o setproperty -pn developer-dashboard -pv off

Change the UI Version of SharePoint from Sp-2010 to Sp-2007

To change the UI Version of SharePoint from Sp-2010 to Sp-2007

  1. Change UI for all sites:

$site = Get-SPSite -identity http://riy-portal1/

$site | Get-SPWeb -limit all | ForEach-Object { $_.UIversion = 3; $_.UIVersionConfigurationEnabled = $false; $_.update(); }

2.Change UI for a particular site or sub-site only:

1: $web = Get-SPWeb http://riy-portal1/Dept/Sustainable/

2: $web.UIVersion = 3

3: $web.Update()

Error Deleting Search Service Application in SharePoint 2010

Error When Deleting Search Service Application in SharePoint 2010

Scenario: You attempt to delete your Search Service Application in SharePoint 2010 through Central Admin but the process never completes or takes too long to complete (and does not actually delete the application). You attempt to delete the Search Service Application again through Central Admin but now receive an error.

You then decide PowerShell is next viable option when deleting so you use the following script:

$spapp = Get-SPServiceApplication -Name “”
Remove-SPServiceApplication $spapp -RemoveData

You receive another error and are still unable to delete the Search Service Application.

Fix: STSADM becomes your friend again here. You will first need to grab the GUID for the Search Service Application. You can do this by…

Log into the server hosting Central Admin

Open SharePoint 2010 Management Shell (PowerShell) as Administrator

Enter Get-SPServiceApplication

Find the Service Application you wish to delete and copy the GUID (You can do this by right clicking in the PowerShell window -> hitting Select All -> Control + C -> Right Click and Paste into a fresh Notepad document -> copy the GUID from the application you wish to delete)

While still in PowerShell, type: stsadm -o deleteconfigurationobject -id *type in GUID here*

This will delete your Search Service Application completely!