Share via


PowerShell Pre-Upgrade Check for Project Server 2013

PowerShell Pre-Upgrade Check

The following PowerShell script is used to check for miscellaneous items that may need to be fixed prior to service packs and cumulative updates.

Basically, I load the script and setup my variables. Then I run each line examining the results looking for anything that may be out of ordinary. At the end, I have a few PowerShell fixes.  For example,  I discovered I had a poorly provision PWA, so I removed it prior to upgrade.

################################################################################## #

# PreUpgradeCheck.ps1

# Updating CU for Project Server

#

Set-ExecutionPolicy "Unrestricted"

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

##################################################################################

#

# Prior to updating CU ---- look for possible issues

#

##################################################################################

$DBServer        = "LABA-2012SQL"

$ProjectDB       = "LABA_ProjectWebApp"

$WebApp          = http://LABA-2013SP

$PWA             = http://LABA-2013SP/PWA

$WSS_ContentDB   = "LABA_ProjectServer_WSS_Content"

$Admin_ContentDB = "LABA_Admin_Content"

#

# Not required:  Used for additional provisioned PWA sites

# Setting for second provision OOB (Out-of-box)

# OOB is used for referrencing what the OOB configuration looks like

#

$ProjectDBOOB    = "LABA_ProjectWebAppOOB"

$PWAOOB          = http://LABA-2013SP/PWAOOB

#

# Examine all and how many PWA instances

# List project instances

# 1) Look for any instances that should be deleted

#

Get-SPProjectWebInstance

#

# Test Project Web Instance

# 1) Check that all STATUS have PASSED

#

Test-SPProjectWebInstance -Identity $PWA

Test-SPProjectWebInstance -Identity $PWAOOB

#

# Test the Project Database State

# 1) Exists is TRUE

# 2) IsProjectDatabase is TRUE

# 3) all others should be FALSE

#

Get-SPProjectDatabaseState -DatabaseServer $DBServer -Name $ProjectDB

Get-SPProjectDatabaseState -DatabaseServer $DBServer -Name $ProjectDBOOB

#

# Test Project Database

# 1) ERROR           should be FALSE

# 2) UpgradeBlocking should be FALSE

#

Test-SPProjectDatabase -WebInstance $PWA

Test-SPProjectDatabase -WebInstance $PWAOOB

#

# Test Each SharePoint Content Database and all categories should be ok

# 1) ERROR           should be FALSE

# 2) UPgradeBlocking should be FALSE

# 3) Message should be positive

#

Test-SPContentDatabase -WebApplication $WebApp -name $WSS_ContentDB

Test-SPContentDatabase -WebApplication $WebApp -name $Admin_ContentDB

#

##################################################################################

##################################################################################

##################################################################################

##

## Tools to fix issue with upgrades

##

##################################################################################

#

# The following lines is used to remove a bad or unused Project Provisioning

#

$PSI= Get-SPServiceApplication | WHERE {$_.TypeName -like "*Project*" }

#Test-SPProjectServiceApplication -Identity 2ffcc47f-19ac-4b9e-9d14-e03f8f1bfdb1

Test-SPProjectServiceApplication -Identity $PSI

#

# Steps to remove a bad instance of PWA

#

$psi = Get-SPServiceApplication | ?{$_.TYpename -like "*Project*"}

$psi.sitecollection.remove("9e21262b-c63d-4a7c-860c-6f9b909de99b")

##

## Remove-SPProjectDatabase

## Remove-SPProjectDatabase -DatabaseServer LABA-2012SQL.LAB.LOCAL -Name LABA-ProjectServerDB

#

Test-SPProjectWebInstance