• Add AD group to all PWA project sites with Read Only permission using PowerShell

    My customer wanted to be able to provide his Portfolio Managers with read only access to all project sites in PWA.  Because an AD group for Portfolio Managers already exists, we can use that AD group in the script and add it to all project sites under PWA with Read Only permission. Credit to Gerald Parish, SharePoint PFE, for the code and helping me test it.

    As always, test this code in your test environment.

    <#
    #################
     Disclaimer
    #################
     This software (or sample code or query) is not supported under any Microsoft standard support program or service.
     The software, sample code, or query is provided AS IS without warranty of any kind.
     Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose.
     The entire risk arising out of the use or performance of the software and documentation remains with you.
     In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the software be liable for any damages whatsoever
     (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss)
     arising out of the use of or inability to use the software or documentation, even if Microsoft has been advised of the possibility of such damages."
    #>
    Exit

    <#
    #################
    Instructions
    #################
    Review the disclaimer above.  Remove or comment out the "Exit" in order to be able to run the script.
    Go to the last line of this PowerShell script file. 
    In that line, change the -site value to the PWA URL. 
    Also, change the -newuser value to be the AD username or group that you want to provide Read Only permissions for.

    For example,...
     AddReadOnlyUsers -site http://projects.contoso.com/pwa -newuser "contoso\Financial Applications Group"
    becomes
     AddReadOnlyUsers -site http://projects.yourdomain.com/pwa -newuser "yourdomain\Financial Applications Group"

    Run this entire script from the SharePoint 2010 Management Shell. 
    The log file will be created in the same directory you run the .ps1 from.
    #>


    Function Local:AddReadOnlyUsers
    {

    [CmdletBinding()]
    Param(
        [parameter(Mandatory=$true)][string]$Site,
        [parameter(Mandatory=$true)][string]$NewUser
     )

    $global:Logfile = ".\" +[Datetime]::Now.ToString("MMddyyyy_hhmmss_tt") + "_User_log.txt"
    try {Start-Transcript -Path $Logfile -ErrorAction Stop } Catch { $Error[0] }

    $permLevel = "Read"
    $SiteCollection = get-spsite $Site
    $AllWebs = $SiteCollection.AllWebs
    foreach ($webSite in $AllWebs) {
       Write-Host -NoNewline "($webSite.url) Adding $($NewUser)..."
       $oNewuser = $webSite.EnsureUser($NewUser)  
       if ($oNewuser -ne $null) {
          Write-Host -ForegroundColor Green "Complete"
          Write-Host -NoNewline "Granting $($permLevel) to $($NewUser)... "
          $roleDef = $webSite.RoleDefinitions[$permLevel]
          $RoleAss = New-Object Microsoft.SharePoint.SPRoleAssignment($oNewuser)
          $RoleAss.RoleDefinitionBindings.Add($roleDef)
          $webSite.RoleAssignments.Add($RoleAss)
          $webSite.Update()
          Write-Host "Complete"
       }
       else { Write-Host -ForegroundColor red "Error"; exit}
    }

    Stop-Transcript
    }

    AddReadOnlyUsers -site http://projects.contoso.com/pwa -newuser "contoso\Financial Applications Group"

  • Project Server 2013 - Minimize loss of work due to unreliable connectivity

    Introduction

    Microsoft Project Professional users sometimes lose their unsaved work due to unreliable or bad internet connectivity. 

    Below are the steps which can help to minimize the loss of work while working with Project Professional 2013. 

    1.1       Enable Auto Save

    1. Auto Save can be enabled and the frequency can be set based on user preference.
    2. User might want to enable and set it for higher frequency, if the internet connectivity is extremely unreliable.
    3. By default, Auto Save option is disabled to reduce the traffic sent to the server.
    4. To enable Auto Save, start Project Professional, then click on File -> Select Options -> Click on Save.

     

     

     

    1.2       Check The Status Of Balloon

    1. Project Professional offers a balloon feature which provides information whether the Project Client is offline (not connected to the server) or online (connected to the server).
    2. The status of the balloon is checked when any activity is triggered from Project Professional to Project Server.
    3. If the status of the balloon if offline, it can be changed to Online by clicking on it.

     

     

    Indication that Project Professional is connected to the server.

     

     

    Indication that Project Professional is not connected to the server.

      

     

    If Project Professional is offline, click on the Balloon, then click on Connect to server to connect to the server. Multiple clicks may be required to connect to the server. This option can be used when the internet connectivity is restored.

     

    1.3       Working Offline

    1. Open Project Professional. Make sure it is connected to the server.
    2. Click on File -> Open -> Select PWA instance Name -> Click on Browse -> Double click on Show me the list of all projects.

     

    3. Click on the Project you want to open. Click on Check-out, if asked.

    4. Once the required Project is open, modified, Click on File -> Info -> Manage Accounts -> Work Offline

     

    Note - Please note that the balloon at the left bottom corner has been changed from Online to Offline.

     

     

    5. When user is done working offline and ready to save back to the Project Server, perform the steps below.

    a. If the internet connectivity has been restored, go online by clicking on the balloon and selecting Connect to Server.

     

    b. Status can be changed to online by clicking on File -> Info -> Connect to Server

    c. Close Project Plan if the internet connectivity has not been restored. Plan can be synced to the server later when the internet connectivity is restored to the server.

    d. In order to Sync Project Plan to the server (assuming that Project application was closed and internet connectivity has been restored), open Project Professional, select the PWA profile which was used last time and click on OK. DO NOT click on Work Offline.

    e. Click on File -> Open -> Select PWA profile -> Click on Browse and open the plan from cache.

     

     

    f. Click on Save, then Publish, and then close the plan click Check-in to check in the Project Plan to the server. The changes made to the Project Plans while working offline, will be synchronized back to the server.

    g. Until you save Project Plan back to the server and check it in, Project Plan will not be available for other users to modify.

    h. Never save the Project Plan locally on your hard drive and upload it back to the server. Saving the project plan locally divorces the project plan from the Project Server and the enterprise resource pool and is considered bad practice.

    Scenarios to save work performed in Project Professional with unrelible internet connectivity.

    1.4       User Is Working In Project Professional, Modifying Existing Project Plan, And The Internet Connectivity Has Been Lost. User Is Unaware Lost Connectivity.

    1. User will be allowed to modify the plan as much as she wants and as long as she is not trying to retrieve any information from the server.
    2. The moment the user tries to the save the Project Plan, Project Professional will automatically turn to Offline Mode and User will no longer be able to save it to the server.
    3. Now, she can close Project Professional. User will be prompted below screen. If the user wants to save all the changes made, make sure that user doesn’t modify any settings provided on the screen,

    4. The changes made by user will be stored in a local cache of Project Professional and the changes are not lost. Note: Storing projects in this fashion happens automatically and is not the same as saving the project as a local .mpp file.

     

    1.5       Internet Connectivity Has Been Restored - User Wants To Save Changes To Server

    1. Follow steps available above in section 1.3, bullet 5, from d to f

     

    1.6       User Is Working In Project Professional. Save/Publish Job To The Server Has Been Initiated And Internet Connectivity Is Lost.

    1. If the job are properly submitted to the server, no data lost should incur. There is a possibility that jobs need to be re-submitted, if they were not submitted properly, when the connectivity has been restored.
    2. If the jobs are not submitted to the server, the user should follow the steps provided in 1.2 to make sure that Project Professional is not offline and can try to connect to the server if the internet connectivity has been restored.  

  • Community Updates - December 2014

    Hello, Microsoft PPM Community.

    This is our monthly blog post about what is happening in the PPM Community around the world.

    This means webcasts/webminars, PMI and MPUG chapter events, and all about what you need to know to stay up to date about Microsoft Project, Project Server, and Project Online.


    Microsoft Project Webcast Series

    Projects solved using Project 2013 - Tips n Tricks
    December 16 @ 12:30pm – 2:00pm EST
    Is your Microsoft Project schedule not delivering the accurate and actionable information you need? Join us for this exciting and practical webinar that will demonstrate tips and tricks for building and maintaining a proactive project schedule. This event will provide you with tools and techniques that you can use right away, to ensure that your project schedule is providing accurate progress and forecast details.
    Presented by Kenneth Steiness & Terry Kneeburg


    MPUG Events

    “EVM” – Earned Value Management – Not Just Another 3 Letter Acronym!
    December 3 @ 12:00 pm - 1:00 pm EST
    Earned Value Management (EVM), can provide a picture of project cost and schedule status. However, what do you require to implement this capability using Microsoft Project or Project Online? This interactive session will outline the steps needed to support EVM and understand the elements and techniques needed to incorporate EVM into your project and portfolio scheduling.
    During this event, students will learn how to make Earned Value Management and Analysis using Microsoft Project possible.
    John Riopel, MCP is President and CEO of PM Providers, a full-service project management consulting firm dedicated to delivering business results with project management solutions. Find out more at www.pm-providers.com.

    Learn from the MVP: Tips & Tricks with Project 2010/2013
    December 10 @ 12:00 pm - 1:00 pm EST
    Have you ever wondered what is the best way to see which tasks are scheduled to take place next week across multiple projects? How can you group task data using specific resource fields? What is the easiest way to create a quick customized TimeLine report for project phases?  How can you tell if your project ending date is really accurate?  During this session, these questions and more will be answered. This session is designed to show you suggestions that you can apply to your schedules to enhance MS Project 2010/2013 immediate usage.
    With over 20 years of corporate training experience, Ellen Lehnert, MVP, PMP, MCT, MCP, is a consultant/trainer for Microsoft Project and Microsoft Project Server. She’s author of  “Managing Projects with Microsoft Project 2010 Desktop courseware,”, technical editor and contributor for several MS Project reference books, and frequent meeting speaker. Ellen brings a unique combination of licensed teacher and programming background to the classes she teaches as well as process development, installations, and consulting. Contact her at ellen@lehnertcs.com or at LehnertCS.


    Partners Events

    Combining Enterprise Social and PPM to Maximize Benefits and Utilization
    December 3 @ 1:00 pm – 2:00 pm EST
    Social technologies are used in roughly 75% of all companies. Few, however, are able to unlock the full benefit. Join this session to witness the kind of productivity possible when using Social Collaboration tools like SharePoint, Project, Lync and Yammer. Learn how you can speed up innovation, connect and engage your employees and transcend traditional organizational structure. Understand the additional value realized through improved team collaboration and communication within and across organizations. Improve decisions and bring together relevant information and people by combining unstructured communication with structured processes. We will also explain what changes in organizational culture are necessary to ensure a successful business transformation.

    Unlock the Strategic PMO Inside Microsoft Project Server
    December 4 @ 1:00 pm EST
    Despite receiving significant investment, traditional PPM tools and processes are simply not delivering the anticipated results. In fact, UMT360 research suggests that companies are missing out on up to 46% of planned business value from their project portfolios. What’s driving this lack of performance? PMOs who fail to recognize that projects are strategic business investments and therefore miss the opportunity to effectively integrate financial management with PPM. As a result, they are unable to proactively gauge the economic impact of poor project performance and take timely corrective actions. Join this webcast to learn how to easily unlock the strategic aspects of Microsoft Project Server with UMT360 and gain complete financial intelligence across project portfolios. Learn how to:

    · Eliminate the need for Excel and standardize investment governance controls across the PPM lifecycle

    · Streamline capital planning and build stronger business cases

    · Automate financial tracking and variance analysis, helping you dynamically reallocate funds to maximize ROI

    · Establish a benefits realization framework and measure results

    The webinar will also include a live demonstration of UMT360, the only Enterprise Portfolio Management solution built on SharePoint that seamlessly integrates with Microsoft Project Server.

    Deliver winning Projects with Microsoft Project Online
    December 11 @ 12:30 GMT
    Easily plan projects and collaborate from virtually anywhere with the right tools for project managers, project teams and decision makers. ​Join us to find out how to:

    · Get up and running with reliability and zero up-front infrastructure costs.

    · Add teams and projects within minutes with a web-based portal.

    · Immediately glean insight about your portfolio with new point and click reporting capabilities.

    · Get Team Members to clearly see all their tasks in one place, across multiple projects.

    · Use the new visual tiles to quickly begin or flex project portfolio management capabilities.

    · Enable your teams to work within a familiar environment. Project Online includes SharePoint Online and comes to you through Office 365.


    If you are aware of some event that will occur this month and it is not listed here, please, leave a comment with the link.

  • Slow Performance for Reporting (Publish) Jobs

    We had a scenario where five particular Project Schedules were taking 8 minutes to finish publishing to the Reporting DB, but the Draft and Published database jobs were finishing in less than a minute. All other 200 schedules in the system would publish almost instantly. What is so different between the fast and slow schedules? Why is the Reporting database publish so much slower than its cousins? Another problem, likely associated, was 30 minute response time opening 15 schedules in bulk from PWA into Project Pro. But, all other aspects the system performed very fast such as Timesheets, opening Project Center and drilling down, opening Resource Center and running availability and allocation views. This was a Shared platform with SharePoint and Livelink and which some believed to be the root cause while others believed the timesheet entry task history was root cause and that Project Server was just maxed out but not so.

    The main difference between the five slow schedules and all the others is the five slow schedules were specially used to capture known ongoing operational work on an annual basis.  We call these Operational Schedules. The tasks were scheduled out by 1 to 2 years with all people in the organization assigned as resources with percent units. This would allow management more accurate understanding of resource availability. An example might be to assign Joe Klein for the year at 50% to the "Maintenance work" task so he shows available the other 50% of the time for other project work. With this Operational Schedule concept in mind, the real root cause will make sense as outlined below. Also, the slowest of the five schedules was an older plan with 1.5 years of timesheet actuals. Why did this one take so much longer to publish to the Reporting DB, but was quick to save to Draft db and Published db?

    To find the answers to our questions, we began with an architecture and platform review, then performed a series of project publishing tests from Project Pro in a systematic process of elimination to determine which component might be the bottleneck. We determined there was no CPU, Memory, or Network bottleneck issues on any of the servers. We copied the four Project Server databases to a virtual machine running on my laptop which uses Solid State drives. Publish time reduced from 8 to 2 minutes; problem solved! It had to be a disk issue! The Production Folks moved the Project Server database files and associated log files to faster disks and now the 15 schedules would bulk open from PWA into Project Pro in less than a minute, down from 30 minutes, and the Reporting Publish job time went down from 8 minutes to 2 minutes.

    I still wanted to know why the Reporting Publish jobs took so much longer on those five schedules, so I fired up PSSDiag and SQL Nexus and found the main culprit is the TimeByDay table population in the Reporting DB. The TimeByDay tables host one record for every day per resource assignment and are used by the OLAP Cubes and custom reports to allow for reporting on Time Phased work.  The Draft and Published databases manage this data differently and do not have such tables nor do they experience the performance problem. In the case of the five special schedules, the TimeByDay is greater than normal schedules because of the 1 to 2 year task spans with hundreds of assignments.  This generates many, many TimeByDay rows in the table, because there is one database row per resource assignment per day for every day of the year (minus calendar exceptions). For example, a two year task with 800 assignments would be approximately 400,000 rows, to be populated to multiple tables including AssignmentByDay, TaskByDay, and Baselines, etc. This generates a ton of operations on the SQL server during Publish operations.


    Below is a SQLNexus analysis chart of what is happening during a Reporting Publish job and you can see the load the TimeByDay updates are exhibiting on the system.


    In an effort to improve the Reporting Publish performance, I tried setting Max DOP in SQL Server to various values.  The best performance was with a value of 1, as per Microsoft recommendations for SharePoint. I put the SQL data files on different drives and got a bit of improvement (because of better disk I/O) and I tried with 4k and 64k Sector size in SQL Server and noted similar speeds. There did not seem to be another way to speed things up other than faster hardware, archiving projects to reduce the database size, or optimizing the schedules.

    It is very interesting to note that changing all tasks to “Manually Scheduled” adds 2 minutes to the Reporting Publish times. (Why would that be? Maybe I should write another blog article on this one?) And with Manually scheduled tasks, even making a few small change to the schedule and publishing it will still apply a heavy load to the Reporting DB but for a shorter duration (about a minute less).  With Auto Scheduled Tasks in same scenario, the Reporting Publish job is quick, but checking in the schedule and re-opening it, then making a small change and publishing will go back to applying heavy load on the SQL Server.

    I was still determined to improve publish times down to at least one minute without faster hardware and I believe the only answer is optimizing the Schedules. I studied the worst offender, an older schedule that has been in use for two years with timesheet actuals captured for 54 resources across 44 tasks for 920 assignments.  This scenario generates a ton of TimeByDay records in the database and the planned work, actual work, and cost values are all populated in the TimeByDay tables.  In fact, the “MSP_EpmAssignmentByDay” table has 19 fields in it, so you can see how each row in the table will add work for the SQL Server.  I wondered if we could reduce this amount by deleting out last years’ daily entries? Will this help performance?  I found that yes, it does, but this may not be the answer either because, generally speaking, you should not have to delete your data in return for performance.

     

    I also tried deleting data to see if this would improve performance, I deleted all projects except two from PWA Server Setting, but received errors in Queue deleting from the Reporting DB.  I considered that maybe my problems are related to a corrupt Reporting DB?  I made a new one by provisioning a dummy PWA instance (changed the extended property key to make PWA provisioning believe it is a valid db). Then to refresh the reporting db with fresh data, I just had to back up and restore the Enterprise Custom Fields using the Admin tool in Server Settings > Administrative Backup and Administrative Restore from PWA. This process completely refreshed all data including projects, resources, custom fields, tasks, assignments, and the “ByDay” work. After all this, publishing times remained the same, so the Reporting DB was not corrupt. Now once again, I tried deleting projects and was successful. The MSP_EpmAssignmentByDay table had 2 million rows when I started deleting projects. I stopped deletions and tested project publishes with 1.4M rows and found the same performance.  I tested with 1M rows, found the same performance again, and I tested with 0.5M rows with no change in performance. I reindexed the Reporting DB, same speeds. Deleting project data does not seem to help.

    Summary and Lessons Learned

    Make sure you have enough Disk I/O available to handle the high volume of executions on the Reporting database when publishing schedules with many "time by day" values. Operational schedules should be treated as projects where there is an end date, so don’t let several years of historical work build up over time. Implement new operational schedules each fiscal or calendar year and close the old ones to get them out of the way, but do not delete them. Think about less detailed breakdown of work in the ongoing operational project plans; overhead is overhead, so you don't need many detailed  task assignments. Don’t start archiving and deleting your completed projects in an effort to improve publish performance, it won’t help much in the near term, and maybe years down the road, it will make sense to archive old projects using a documented archive plan with a regular archive process frequency.

    The Reporting database could be considered a non-critical database, because it can be re-built easily and therefore,  could be placed on cheaper Solid State Drives. If the drive does fail you will have a reporting outage, but PWA will still operate (until the Application Pool is recycled) giving you time to replace the SSD so the risk of failure and major outage is low and could dramatically improve performance at a low cost.  A note: do not refresh the Reporting database during business hours because this process is VERY disk intensive on the SQL Server.

    SQL Server's Max Degree of Parallelism (MAXDOP) property with a value of 1 is recommended for optimal performance of SharePoint and is a mandatory setting for SharePoint 2013. My testing here proves MAXDOP of 1 is an optimal setting for Project Server, as well, so a single instance of SQL Server for both products might be your best choice, but make sure your disks are architected properly with plenty of disk I/O.  Try to get your own set of spindles and LUNs for Project Server, because this product can make intensive use of disk I/O.  Keep in mind that Project Server was designed to allow the Administrator to configure the Reporting database to a different SQL instance than the Archive, Draft, and Published databases, this could be an answer also to improve performance.

  • PowerShell Script to automate the data refresh for Project Server 2010

    Repeatable Data Refresh Project Server 2010

    Scenario: You need one or more additional Project Server environments for your patching, testing and development processes. You want an easy and repeatable way to refresh an environment to match the latest production data and EPM configuration. Project Server may or may not be part of your organizations main SharePoint farm, storage is not an issue and you do not need the Reporting and BI service application components restored each time, just the Project Server databases and associated SharePoint content databases.

    Audience

    SharePoint farm administrators, Project Server farm administrators, and disaster recovery engineers. This process can be used as part of your Disaster Recovery plans in order to develop a comprehensive procedure.

    Environment

    This procedure is for SharePoint 2010 and Project Server 2010 to refresh databases on different servers in the same AD domain. This should work on 2013 versions but has not been tested.

    Resources

    These links refer to official Microsoft documentation, however, when in doubt, please refer to TechNet articles. You will also find detailed PowerShell commands and detailed step by step instructions that will help you perform the process described in this document.

    Copy configuration settings between farms (SharePoint Server 2010)

    Best Practices for Backup and Restore

    Project Server Database Only Restore

    The following is a repeatable way to build or refresh a Development (or other) environment to match the latest production data and EPM configuration. This scenario will use an existing farm (target farm) where PWA already exists. Your target servers will have different names and possibly different accounts but they must be part of the same domain as production for the procedures to work.

    Prepare your target Servers

    The following is a check list to complete before beginning the physical restore process.

    1. Windows Server version and patch level should match production servers and SharePoint version and patch level must match production. The SQL version, collation, and patching levels should match between Production and Target environments.

    2. Restore a copy of the SQL databases from Production SQL instance to the target SQL instance, using an SQL tool of your choice. (It is often simpler to take the previous night’s backups for restoration) This should include 5 databases as a minimum, all 4 Project server databases and the project sites content database(s). Note: this procedure does not include automating this step in a repeatable way, typically the DBA will handle it.

    3. Make sure your Farm Admin account is in Local Admin Security group on the WFE box and that it belongs to the correct SQL Roles (Security Admin and DB Creator).  Also, assign dbo rights for the new Farm Admin account to each database after a copy of the databases are in place on the target SQL environment.

    4. Since the target PWA already exists, make sure it is running and tested before you start the procedure so you know the host headers, IP numbers etc. are all in place and operational in case of errors during the procedure.

    5. The target web application is built matching production Authentication providers such as NTLM or Claims etc.

     

    Running the Procedure Manually

    The following is a checklist of steps to take on one of the Web Front End (WFE) servers to complete the restoration process manually. The script below automates this in one command.

    1. Delete the old PWA Site and Site Collection. From Central Admin navigate to Service Applications > Choose appropriate “Project Server Service App”  > “Manage Project Web App Sites” page, click Delete.

    2. Detach the Project Sites Content DB from the Web App that Project Server is using. From Central Admin navigate to Application Management > Manage Content Databases > select your Web App and click the Database name in question and check the box “Remove Content Database”.

    3. Re-start IIS (optional).

    4. Mount the Project Sites Content Database. From Central Admin go back to “Manage Content Databases”, select your Web App and add your database.

    5. Provision new PWA Instance from “Manage Project Web App Sites” page in Central Admin. (Make sure to enter the 4 Project Server database names that match the restored names).

    6. Test the PWA instance.

    7. Re-deploy or install any custom solutions, third party web parts as required.

    8. Final testing.

     

    PowerShell Script to Automate the Refresh

    #Begin Script

    # Use this script to refresh Project Server with new data from another Farm.

    # This script is NOT meant to run in production. There is no error handling, although you can make your own or use the built in error handling.

     

    #Instructions

    # First, have your SQL databases restored to the target database server (reference that server with the $DataBaseServer parameter below).

    # Change the parameters section to suit your environment.

    # Run this script in PowerShell ISE or the Windows PowerShell command line.

     

    ##### Start Parameters section

    $FarmAdmin = "rlan\spadmin"    #Make sure the farm admin account you use has dbo rights on the 5 databases

    $DBPrefix = "SP5-2"     #I use this to prefix the database names, helps organize databases on SQL box

    $Protocol = "http://"

    $MyHostHeader = "ps.rlan.ca"   #Replace the host header with your own value.

    $PwaName = "PWA"

    $WebAppPort = 80

    $DataBaseServer = "sql1"  #Replace with your own DB name or sqlalias.

    $Archive = "ProjectServer_Archive"

    $Draft = "ProjectServer_Draft"

    $Published = "ProjectServer_Published"

    $reporting = "ProjectServer_Reporting"

    $PWAContent = "WSS_Content"

    ###### end paramaters section,

     

    ### Do NOT change anything below this line.  ###

     

    $ver = $host | select version

    if ($ver.Version.Major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"}

    Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

     

    $ProjectWebAppURL =  "$Protocol$MyHostHeader"

    $PwaWeb =  "$Protocol$MyHostHeader/$PwaName"

     

    # Remove PWA and dismount the content db (sites)

    # Cannot dismount first, will get error site is missing

    Remove-SPProjectWebInstance -Url $PwaWeb

    Sleep 5

    Dismount-SPContentDatabase $PWAContent

     

    # You may get this error New-SPProjectWebInstance : Database validation failed. Reason: DatabaseInUse.

    # so this may need to sleep longer, test in your environment, and run it again

     

    sleep 5

     

    # Re-provision with new databases  Create Project Service Application

    Mount-SPContentDatabase $PWAContent -DatabaseServer $DataBaseServer  -WebApplication $ProjectWebAppURL

    sleep 5

    New-SPProjectWebInstance -AdminAccount $FarmAdmin -Url ($ProjectWebAppURL+ "/" + $PwaName)  -ReportingDbserver $DataBaseServer -ArchiveDbname ($DBPrefix+$PwaName +"_Archive") -DraftDbname ($DBPrefix+$PwaName +"_Draft") -PrimaryDbserver $DataBaseServer -PublishedDbname ($DBPrefix+$PwaName +"_Published") -ReportingDbname ($DBPrefix+$PwaName +"_Reporting") -Lcid 1033

     

    #optionally look at properties

    #$SPProjectWebInstance = Get-SPServiceApplication | ? {$_.TypeName -like "*Project*"} |  Get-SPProjectWebInstance 

     

    #optionally remove re-provision SA

    #Get-SPServiceApplication –Name $saName  | remove-spserviceapplication

    #New-SPProjectServiceApplication –Name $SvcAppName –ApplicationPool $ProjectWebAppPool –Proxy

    #End Script

     

     

     

     

    How to run the script automatically on a pre-determined schedule

    http://get-spscripts.com/2011/01/running-sharepoint-powershell-script.html

     

    How to edit and execute the script in PowerShell ISE (recommended)

    http://blogs.technet.com/b/msjimblog/archive/2013/06/25/writing-and-running-scripts-with-powershell-ise.aspx