Archive

Posts Tagged ‘PowerShell’

Issue Downloading SharePoint 2010 Prerequisite Installer Files

April 25, 2012 2 comments

Strictly speaking this quick article doesn’t really have anything to with SharePoint, but hopefully it might help-out someone out there in SharePoint land.

One of the projects I’m currently working on is a 2010 Farm build, we are just getting the media set ready to install SharePoint with AutoSPInstaller, and of course need to download the Pre-Requisite Installer Files. For this particular project I have no local access to the servers so everything is being done by RDP on the server. So to download the Pre-Requisite Installer Files I’m was using this script from codeplex, but it was failing with a really wierd error

 

image

 

I tried it on a few different servers, but they all had the same problem.

I could of course simply open the script, grab the URL’s and paste them into a browser, but where is the fun in that.

This KB article talks about foreground / background transfers, and this being a problem when using background transfers and that foreground should be okay.

This article describes the cmdlet references for BITS and the –Priority switch that controls the foreground / background transfer setting

So the fix was to change this line

Start-BitsTransfer -Source $Url -Destination $DestFolder\$DestFileName -DisplayName "Downloading `’$DestFileName`’ to $DestFolder" -Priority High -Description "From $Url…" -ErrorVariable err

to this line

Start-BitsTransfer -Source $Url -Destination $DestFolder\$DestFileName -DisplayName "Downloading `’$DestFileName`’ to $DestFolder" -Priority Foreground -Description "From $Url…" -ErrorVariable err

and Voilá, pre-reqs downloaded . Smile

Retrieving #ProjectServer database names from the URL #in #PS2010

February 21, 2012 Leave a comment

So today my colleague needed help with returning the Project Server database names from PowerShell.

The usual process occurs here within CPS in this scenario, email to the whole team asking the question and this results in a variety of response from the sensible to the ridiculous to achieve the end goal.

The sensible suggestions is as follows:

PowerShell:

Get-SPProjectWebInstance

Example Output:

image

Categories: Work Tags: ,

Fun with PowerShell and Feature Activation

February 14, 2012 3 comments

I was recently working on a system where we wanted to create a site based on a previously saved site template, unfortunately when trying to create the site we were getting the error.

Error creating site: The site template requires that the Feature {some-or-other-GUID} be activated in the site collection.

Hmm, oh well, off to Site Collection Administration and I switched on all the features I could find, but still no joy, time to crack open PowerShell.

First thing to do is find the name of the feature we are looking for, this excellent post on MSDN lists all the SP2010 features and their GUID’s.

Now we know the name of the feature we are looking for its time to get PowerShelling…

Firstly lets list all the features we have installed and activated, open PowerShell from the Microsoft SharePoint 2010 Products folder from the start menu.

image

the Cmdlet Get-SPFeature is the one we are going to use, this gives us a massive amount of output, so  lets add the –Site switch, so we now have Get-SPFeature –Site <myurl>,

image

again we have lots of output, so let use the Out-File Cmdlet to pipe the output to a text file called “features.txt”, so our command is now Get-SPFeature –Site <myurl> | Out-File c:\features.txt

image

now from PowerShell all we have to do is type Notepad c:\features.txt

image

and we have a notepad file with all our site scoped features listed, a quick search for our missing GUID shows no entry, so we have to activate the feature with PowerShell, this is simply a case of typing Enable-SPFeature –Identity <FeatureName> –url <myUrl>,

image

Job done.

Missing Server Side Dependencies–Useful links for diagnosis and removal #SP2010 #PS2010 #SharePoint #ProjectServer #in

January 17, 2012 4 comments

Some quick links to help diagnose the “Missing server side dependencies” errors from the health check analyzer in SharePoint 2010.

Helps remove features via a GUI interface (be careful with this tool!)

Removes feature dependencies from the database via PowerShell (be care with this script!)

Once you have removed the dependencies, re-run the health check analyzer for the “Missing server side dependencies” rule and you may have some residual files to clean up in the content database.

Use the following PowerShell scripts to analyse the location of the files and then you can clear them up appropriately:

Recreating the SharePoint 2010 State Service #SP2010 #SharePoint #PS2010 #MSProject #ProjectServer

July 20, 2011 1 comment

My client was so eager to get SP1 and the June 2011 Cumulative Updates up and running on the Development and Test environments that on day one I was installing and testing the updates on my project.

What on earth was my clients requirement I hear ask? couldn’t they wait?

Well the end users are heavy Linux users and the requirement for Timesheet data entry within Firefox is v.strong.  As a result, testing SP1 outside of the beta that we had already tested was top priority.

Of course, a few days later the June 2011 Cumulative Update was re-released and it is widely known that the State Service among other things can go wrong.

Looking into it further and the State Service cannot be created in the usual method (clicking the new button in the Managed Service section of Central Administration).

So PowerShell to the rescue:

 

$StateServiceDB = "SP2010_StateService"
$GetSPStateServiceApplication = Get-SPStateServiceApplication

If ($GetSPStateServiceApplication -eq $Null)
{
   Write-Host -ForegroundColor White "- Creating State Service Application..."
   New-SPStateServiceDatabase -Name $StateServiceDB | Out-Null
   New-SPStateServiceApplication -Name "State Service Application"
 -Database $StateServiceDB | Out-Null
   Get-SPStateServiceDatabase | Initialize-SPStateServiceDatabase | Out-Null
   Write-Host -ForegroundColor White " - Creating State Service
 Application Proxy..."
   Get-SPStateServiceApplication | New-SPStateServiceApplicationProxy
 -Name "State Service Application Proxy" -DefaultProxyGroup | Out-Null
   Write-Host -ForegroundColor White "- Done creating State Service
 Application."
}
Else 
{
   Write-Host -ForegroundColor White "- State Service Application
 already exists."
}

Creating a SP2010 Farm with local accounts in Server Mode #in #SP2010 #SharePoint

March 20, 2011 Leave a comment

So, it’s the weekend and I have decided to build myself a SharePoint 2010 / Project Server 2010 development environment so I can play with some ideas at home as well as update my CodePlex projects.

Now in MOSS 2007 you used to be able to create a server farm connecting to a full SQL Server on the same box by not choosing Standalone mode during the setup.

In SharePoint 2010, it would appear that this is not the case using the GUI setup or even stsadm as it will not accept local accounts during the setup wizard

However in PowerShell you can.

The following articles have been useful during my setup process:

Blog: From The Field – http://sharepoint.microsoft.com/blogs/fromthefield/Lists/Posts/Post.aspx?ID=112

MSDN Forums: http://social.technet.microsoft.com/Forums/en/sharepoint2010setup/thread/574bb98b-7751-4b23-a71b-857c6664804b

As a basic overview (and as a reminder to myself):

  • Install the pre-requisites
  • Install the binaries
  • Run the SharePoint 2010 Management Shall as the Server Administrator
    • PS Command:New-SPConfigurationDatabase

    Once you have done this, run the PSConfig GUI (Start > All Programs > Microsoft SharePoint 2010 Products > SharePoint 2010 Products Configuration) and you will find that you are connected to the farm.

Do not disconnect and click next.  The standard wizard will now run and setup Central Administration for you.

This is running for me at the moment, so if I find any further gotchas I shall update this post.