Archive for December, 2012

Fixing SharePoint 2010: Clicking the icon in Type column is highlighting the item instead of launching the document

December 28, 2012 Leave a comment

There is a known issue in SharePoint 2010 that when clicking on the Icon in a Type column will only highlight the item and will not lauch the document like it did in SharePoint 2007.

If you run into this issue, below is the link to the fix by Microsoft.;en-US;2457975

SharePoint 2010 Maintenance Series: Check Disks using PowerShell

December 28, 2012 Leave a comment

If your IT enviornment is one of the lucky ones that have already implimented System Center Operations Manager (SCOM) then the easiness of monitoring and maintaing your SharePoint environments is simple.  If you are not one of the lucky ones you can impliment a series of PowerShell scripts to help you monitor your environment.  This blog posting will be the first of a series of scripts you can use to help monitor.

First in the series is a script that checks the local disk space on your front ends to make sure there is enough space available and sends out alerts and emails when avaiable space is running low.  Those that work with SharePoint know that IIS logs and ULS logs can quickly consume alot of space on your local drives.  If you have an extensive amount of drive space then this might not be a prolem, but if you don’t this can cause serious problems and space needs to be cleaned up before SharePoint decides to stop working.

Copy the below PowerShell scipt and paste into Notepad.  Change the values highlighted in “red” to reflect your SharePoing environment.  Save as check-disk.ps1 or anyname of your choosing.

Now you can add this script to a Task Scheduler to one of your servers in the fam as scheduled job.

Credit for this script goes to my co-worker Tony Brown who initially developed this handy script.


function test-disk {
“Failed.  Details: $($_.Exception)”
$emailFrom =
$emailTo =
$subject = “PS Monitor – $svcname on $server is inaccessible”
$body = “$svcname on $server is inaccessible.  Details: $($_.Exception)”
$smtpServer = “Name of SMTP Server”
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)

$disks = get-wmiobject -class win32_LogicalDisk -ComputerName $server

$disks | % {
if ($_.DriveType -eq 3 -and $_.FreeSpace -le 2000000000 – and $_.volumeName -ne “MSTDC” -and $_.VolumnName -ne “Quorum”) {
$free = $_.Freespace/1024/1024
$freepct = ($_.Freespace/$_.Size) * 100
$emailFrom =
$emailTo =
if ($_.FreeSpace -le 100000000) {$subject = “SP2010 Monitor – $($_.Name) on $server is VERY LOW on disk space”} else {$subject = “PS Monitor – $($_.Name) on $server is low on disk space”}
$body = “$($_.Name) ($($_.VolumnName)) on $server has {0:N0} MBs available ({1:N1}% free)`n`nPlease remove extra files from temp directories and user profiles.  Try reducing logging or deleting old backups to prevent a disk outtage. `n`nSent from NAME OF Server, monitoring the SharePoint 2010 system. `nhttp://portal” -f $free, $freepct
$smtpServer = “Name of SMTP Server”
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)

test-disk “Name of Server Front End 1”
test-disk “Name of Server Front End 2”
test-disk “Name of Central Admin Server”
test-disk “Name of Index Server”
test-disk “Name of Crawl Server”


Get a Listing of Hyperlinks in SharePoint 2010 using PowerShell

December 20, 2012 1 comment

I needed to grab a listing of all hyperlinks in my SharePoint 2010 web apps that had referenced links that linked back to our old SharePoint 2007 environment as a post cleanup after a data migration.

Below is the PowerShell script I used to get me that list.


$webApp = Get-SPWebApplication “http://portal

#Write headers for .csv file

“listURL `t” + “listName `t” + “Item/Link Name `t” + “linkURL” >> HyperLinks.csv

#iterate through the lists

foreach ($webs in $webApp | Get-SPSite -Limit All | Get-SPWeb -Limit All)
foreach ($list in $webs.Lists)
#Find all hyperlink fields in list
$fields = @()
foreach ($field in $list.Fields)
if ($field.TypeAsString -eq “URL”)
$fields = $fields + $field.Title
#Skip list because there are no hyperlink fields
if ($field.Count -eq 0) {continue}

#iterate through list items
foreach ($item in $list.Item)
foreach ($field in $fields)
$fldValue = $item[$field]
if (fldValue -ne $null)
#if statement if you want to check for a specific URL, if not no need for if statement

if ($fldValue -like “http://oldportal/*”)
$webs.Url + “/” + $list.RootFolder.Url + “`t” + “$list.title” + “`t” + $item.Name + “`t” + fldValue >> HyperLinks.csv

Fixing: The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered when trying to run SharePoint 2010 PowerShell

December 20, 2012 6 comments

Recently I ran into this problem on my SharePoint 2010 farm which prevented me from running any PowerShell scripts or Cmdlets using the SharePoint 2010 Management Shell.  It was working fine before, but then recently when I would try to bring up the Management Shell with admin rights/farm admin rights I keep getting this error:

“The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered when trying to run SharePoint 2010 PowerShell”

Now this message would initially come up when you first build out your SharePoint 2010 farm, but since my farm has been configured and running for over a year now I was little concerned.

This message would also show up if you try to run the SharePoint 2010 Managment Shell without the proper permissions, or if the account does not have the proper permissions in SQL.

However, in my case I knew that the account had the proper permissions to run the Managment Shell, and also the proper permissions within SQL.

If both are also true for you, and you still receive this error, then try this for the fix.

Apparently (for unknown reasons) still looking into the cause, the SharePoint 2010 Management Shell was pointing to the incorrect version or path that is invalid and not compatible.

To Verify which version is being used

1.  Bring up SharePoint 2010 Managment Shell (ignore) the error Message
2.  Type:

$ver=$host | select version

3.  If you receive something like below.  If the Major version is not on 2, then you will get this runtime error.

Major  Minor  Build  Revision
—–  —–  —–  ——–
3      0      -1     -1

4.  Close out of SharePoint 2010 Managment Shell.
5.  Go back to the SharePoint 2010 Managment Shell Shortcut, right click and select “Properties”
6.  Under the Shortcut tab, Target: section, insert “-version 2” into the path, like so.  Make sure its before the -NoExit.

C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe –version 2 -NoExit ” & ‘ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ‘ ”

7.  Click apply, and then Ok
8.  Reopen up the SharePoint 2010 Managment Shell with admin rights, and you should now no longer receive that error, you should then be able to run your scripts.

Again not sure why this happened, or what caused it.  I will look more into the reasoning.  However, hopefully this helps others that are having a similar issue.

Install SharePoint 2010 Using PowerShell

December 13, 2012 1 comment

Install SharePoint 2010 using PowerShell.

1.    Run the setup.exe file located in the SharePoint x64 Folder.

2.    Accept the User Agreement and Enter in the Product Key.

3.    Select Server Farm from the Choose the installation you want window.SharePoint 2010 Install 1

4.  Select the Complete – Install all components.  Can add servers to form a SharePoint farm optionSharePoint 2010 Install 2

5.    The wizard will run through the initial installation steps.

6.    After the SharePoint 2010 installation is complete, uncheck the checkbox next to Run the SharePoint Products Configuration Wizard now to avoid running the Configuration Wizard and click the Close button.

7.    Bring up the SharePoint 2010 Management Shell (Powershell) with Admin rights.  All Programs –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Management Shell

8. SharePoint Screen Shot 2

9.  You will be presented with the error message: “The local farm is not accessible.  Cmdlets with FeatureDependancyId are not registered.”   This error message is normal, it’s just telling you that the SharePoint farm has not yet been configured.

SharePoint Screen Shot 3

10.  Enter in the following Cmdlets, replacing [DatabaseConfigName],[DatabaseServerName] and [DatabaseAdminName] with the names of your SharePoint Configuration Database, Database Server, and SharePoint Admin Database names and hit Enter.

11. New-SPConfigurationDatabase -DatabaseName [DatabaseConfigName] -DatabaseServer [DatabasServerName] -AdministrationContentDatabaseName [DatabaseAdminName]

12. You will be prompted to enter in the Farm Credentials and Password.
After entering in the Farm Credentials and Password you will be prompted to enter in the Farm PassPhrase (Make sure to copy this down to some place safe)

13. Install-SPHelpCollection –All

14. Initialize-SPResourceSecurity

15. Install-SPService

16. Install-SPFeature -AllExistingFeatures

17. New-SPCentralAdministration -Port 1026 -WindowsAuthProvider “NTLM”

18.   Install-SPApplicationContent