Alexander Vanwynsberghe

"There is nothing impossible to him who will try"

Quick PowerShell note: Get available constructors

When you’re working with PowerShell, you occasionally will be using .Net types to create objects . One thing that I noticed is that it’s quite difficult to know the correct types of the arguments that you can pass to the different constructor methods. Some piece of PowerShell that I had was:

In that (small) example, I did a reflection of the XDT DLL, and I wanted to create an “XmlTransformation” object to do some XDT transformations (which is pretty cool, and recently release to NuGet btw!). In that case, I wanted to know what the available constructors are, and what arguments you can pass. If you do this with for example C#, you can just press F12, and that’s it. But not with PowerShell. After some google’ing bing’ing I found this little function:

All you have to do now is run this:

That’s pretty cool, that was exactly what I was looking for! Now I can create an object using:

Small, but useful. 

Install Project Server 2013 with PowerShell

Last week, I was working on my demo environment to be used for some future presentations. When I was looking around on the great MSDN world to get some best practices related to a Project Server 2013 Preview installation, I came across a link called: “Install Project Server 2013 with Powershell” by Jime Cox. That sounds really cool, although is easy to memorize the steps to install Project Server through Central Admin after you have done it a few times, it’s more fun to automate this process and adjust it to your own needs. And that’s where the PowerShell part is rocking!

In this post, I want to provide my experience about the installation of Project Server 2013 Preview using the PowerShell script.

First thing you have to do is to perform the installation of Project Server 2013 on a SharePoint 2013 server. You have to perform this step on each application server of your SharePoint farm. You can download Project Server 2013 preview from this link. Once the download has completed, run the setup. First thing you have to do is provide your key (which is available from the link):

Next step is to click ‘Install Now’. This will start the actual installation.

When the installation is ready, it will ask to ‘Run the SharePoint Products Configuration Wizard’. Leave the check box active, and click ‘Close‘.

On the SharePoint Products Configuration Wizard, follow the steps of the wizard, and use the default settings:

Connect to your existing SharePoint Farm, and continue the configuration:

Ok, now that we have installed Project Server 2013. It’s time to ‘activate’ and ‘configure’ it. We will use PowerShell to help us with this task. You can download the script from this link. This is how the script is constructed:

Personally, I really love PowerShell when you execute it with the PowerShell ISE (Integrated Scripting Environment). This way, you can debug and re-factor your scripts very quickly. First part of the script is required if you run the script directly from the PowerShell ISE. What it does is loading the required SharePoint functions into your PowerShell session. If you run the script directly from the SharePoint PowerShell command line tool, you don’t need to do this.

NOTE: You need to execute the scripts with your Farm Admin account. This way, you will never get permission errors!

Next part is the definition of the variables. They contain the URL’s, accounts, your SQL server,..

Next part checks of the SharePoint 2013 timer service is running. If not, it starts this service

In this next part, the Project Server Application Service is checked. If you did not install Project Server on your SharePoint Application server(s), this should result in an error. If the Service Instance is not online yet, the script will try to start it.

Now the fun part. In this step, we will create an Application Pool and a Web App. The FarmAdmin account is used as Application Pool Account. The second part of this piece will create a web application, using the application pool we’ve just create. It will also create a Content Database.

Now we will create the Project Service Application. It will use the Project Application Pool from the last step.

Next step is to create the actual Project Server Database. Note that in Project Server 2013, there is only one database, related to Project Server 2010 who has multiple databases.

In this step, we will create a new Site Collection for PWA, and enable the Project Web App site collection features

To create a Project Web App in an existing site collection, you run the  Windows PowerShell cmdlet to create the web and then run the Upgrade-SPProjectWebInstance to perform post-provisioning actions, including creating a Business Intelligence Center.

When you executed all those steps, you should have your PWA up and running.

Have fun!