Create a scripted SharePoint 2013 Development Environment Tutorial – Part 1

Create a scripted SharePoint 2013 Development Environment Tutorial – Part 1


Creating a SharePoint Development Virtual Machine is something you might have to do quite a few times as a Developer. Even if it’s a pretty easy process, on a slow machine it can easily kill 4-5 hours of your day only to install SQL, SharePoint, Visual Studio and all the others tools you might need to get started. What if you could just script it so it’s all done automatically while you go take coffee, chat on SharePoint Community or whatever else you enjoy doing? In this tutorial we will learn how to build a script that we will keep using for as long as you keep developing on SharePoint 2013. The tutorial will be split in a few sections since in order to keep them focused and short, and at the end they will all be published in a downloadable PDF. I strongly encourage you to not only copy the scripts, but actually read the blog posts of why I did them like this and there are some parts where you will need to work as well! This Guide will show you how to install the following:

  • Microsoft SharePoint Server 2013 – August 2013 CU (Also show you how to install future ones)
  • Microsoft SQL Server 2012 + SP1
  • Microsoft Visual Studio 2012 + All the developers tools needed for SP 2013

Optional extra software:

  • Microsoft SharePoint Designer 2013
  • Google Chrome
  • Firefox
  • NotePad++
  • Smtp4dev
  • ULSViewer
  • HNSC Creator


  1. Introduction & Prerequisites & Creating the Domain and Service Accounts
  2. Installing software prerequisites + SQL
  3. Installing SharePoint 2013
  4. Installing Visual Studio 2012 and Optional Software
  5. Basic Optimizing and Summary
  6. Advanced Optimizing of the scripts! (You are here)
  7. An eBook Guide of the 6 sections and a video! (19/11/2013)


  • A Windows Server 2012 Virtual Machine
  • The Virtual Machine should have 2+ Cores (to avoid SharePoint 2013 Installation Error)
  • 1 Private Network Card attached to the virtual machine. Do not add your External card with internet connection right away, I will tell you when you can!
  • All the Binaries and Licenses for the software you want to install.

Creating the Domain and Service Accounts

Now that the Windows Server 2012 Virtual Machine is installed, the first thing we need to do is set the Execution Policy to Unrestricted. So, we will run this command:

Set-ExecutionPolicy unrestricted

Also, you can optionally turn off UAC to avoid annoying prompts on the development machine with this command New-ItemProperty -Path HKLM:Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -PropertyType DWord -Value 0 -Force Then first need to change the PC name to something understandable! So we will run this command (Don’t forget to change the PC Name to whatever you want):

$pcname = "DevMachine1"
Rename-Computer -NewName $pcname -force

Next, we will set our private network card to a static IP. If you don’t, it will give errors later when creating the new forest. We set it to a static IP with this script:

$netadapter = Get-NetAdapter -Name Ethernet
$netadapter | Set-NetIPInterface -Dhcp Disabled
$netadapter | New-NetIPAddress -IPAddress -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses ""

Afterwards, we will Install the Active Directory Domain Services Role and Management tools, and restart the computer to make sure the NameChange finishes successfully.

Import-Module Servermanager
Add-WindowsFeature -Name "ad-domain-services" -IncludeAllSubFeature -IncludeManagementTools

After the computer restarts, log in with the administrator account and we will finally create the new forest and domain. The Script is the following (make sure you change the “vladdev.local” and “vladdev” for domain you wish to have)

Import-Module ADDSDeployment
Install-ADDSForest <code>
-CreateDnsDelegation:$false </code>
-DatabasePath "C:\Windows\NTDS" <code>
-DomainMode "Win2012" </code>
-DomainName "vladdev.local" <code>
-DomainNetbiosName "VLADDEV" </code>
-ForestMode "Win2012" <code>
-InstallDns:$true </code>
-LogPath "C:\Windows\NTDS" <code>
-NoRebootOnCompletion:$false </code>
-SysvolPath "C:\Windows\SYSVOL" <code>

The computer will now restart, and will ask you to re-login, but now it’s a Domain Controller (You can now add your internet connection for the rest of the tutorial )! We now need to create our SharePoint 2013 Service Accounts. To easily make that scripted, you should download the SharePoint 2013 Service Account Creator tool from CodePlex. When this tutorial was made, the tool was in version 1.5, so if the latest version is not 1.5 make sure you check if anything changed between then and now! What we are also going to do is create a folder on the C drive called “SharePoint” (C:\SharePoint). It’s very important to call it exactly like that because we will hardcode it in PowerShell to allow easier automation. So after we download and extract the tool in C:\SharePoint it should look like this: SharePoint 2013 Development Environment Tutorial We will open PowerShell like an Administrator, and run the following script to create the accounts:

cd c:\SharePoint
.\sp2013serviceaccounts.ps1 -Level high -SPOU "SP Service Accounts" -SQLOU "SQL Service Accounts" -SQLLevel high -OptionalAccounts $true

Then, the script will ask us to input the password for all the service accounts. Since it’s a Development environment, we can give all the accounts the same password, so for example I want it to be “pass@word1” and Press Enter.

Now, the PowerShell script should run fine and the result should be something like this:

And, if you go check out the Active Directory Users and Computers, you should now have two new Organizational Units (OU) for Service Accounts called “SP Service Accounts” and “SQL Service Accounts” with a bunch of users in them

You might ask yourself why we don’t run everything under 1 user, since it’s a development machine… In my opinion a development machine should be as similar to a production one as possible and therefore running your code with only 1 account and many accounts may make you think works perfectly, but will not work in a more secure environment.

Summary of Part 1

In part 1 of the tutorial, we ran a bunch of PowerShell commands, but we can easily create only two scripts with them to make it easier to run afterwards. The first command you will always need to run by hand is “Set-ExecutionPolicy unrestricted” and, you cannot get away from this one. Next, let’s group our commands in three scripts. The first script who will prepare the VM for the Domain Creation.

#Name: preparepc.ps1
#Purpose: Prepares the Virtual Machine for the Domain Creation
Set-ExecutionPolicy unrestricted
#turn off UAC
New-ItemProperty -Path HKLM:Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -PropertyType DWord -Value 0 -Force
#Set Static IP on Card
$netadapter = Get-NetAdapter -Name Ethernet
$netdapter | Set-NetIPInterface -Dhcp Disabled
$netadapter | New-NetIPAddress -IPAddress -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses ""
#Change PC Name
$pcname = "DevMachine1"
Rename-Computer -NewName $pcname -force
#Add AD DS Role
Import-Module Servermanager
Add-WindowsFeature -Name "ad-domain-services" -IncludeAllSubFeature -IncludeManagementTools

The second script who will create the domain!

#Name: createdomain.ps1
#Purpose: Creates the new Forest
# Windows PowerShell script for AD DS Deployment
Import-Module ADDSDeployment
Install-ADDSForest </code>
-CreateDnsDelegation:$false <code>
-DatabasePath "C:\Windows\NTDS" </code>
-DomainMode "Win2012" <code>
-DomainName "vladdev.local" </code>
-DomainNetbiosName "VLADDEV" <code>
-ForestMode "Win2012" </code>
-InstallDns:$true <code>
-LogPath "C:\Windows\NTDS" </code>
-NoRebootOnCompletion:$false <code>
-SysvolPath "C:\Windows\SYSVOL" </code>

And the Third Script that Creates the Accounts

#Name: createaccounts.ps1
#Purpose: Creates Service Accounts
cd c:\SharePoint
.\sp2013serviceaccounts.ps1 -Level high -SPOU "SP Service Accounts" -SQLOU "SQL Service Accounts" -SQLLevel high -OptionalAccounts $true

Now that we got them, let’s create those scripts and put them into our C:\SharePoint Folder. It should look something like:

Head over to Next Sction:   Installing software prerequisites + SQL 

Share this post with your followers on twitter:

Leave  a comment and don’t forget to like us on Facebook here and to follow me on Google+ here and on Twitter here  for the latest news and technical articles on SharePoint.  Also, don’t forget to check out SharePoint Community.Net for more great SharePoint Content

5/5 (1)

Please rate this


very good start to this series. I have a uber script myself for my dev rig, interested to see yours

Rafael Guedes

Very well written post! Keep up the good work.

Roberto Alessi

Can you explain how to correctly create a Private Network Card ? in my case i use vmware workstation. And if i would use a real hardware? in this case i should buy another network card ? where to find instructions?

Thanks for solving my issue, I am looking for this since long.

Frédéric Aubé

Thank you for these posts. I never had a SharePoint development environment configured so well!


You can install SharePoint 2013 on Windows 8 using this tool, you decide if it’s a good fit for you 🙂


As you said in the blog post “It is COMPLETELY unsupported by MS and should only be used for a local development/demo machine.”. However, I love the idea and will probably check it out! Thanks for Sharing!

For anyone out there that finds this blog, and had manually created the domain before running the script. Make sure never to name your domain and server the same, it will cause a lot of issues in the follow-up posts. I learned the hard way. Not my brightest moment.

Vlad, Thanks for the awesome series of posts on creating sharepoint dev environment. Keep it UP

SharePoint 2013 Online Training

As a Newbie, I am constantly exploring Online for articles that can be of assistance to me.Thank you

Trying your scripting for SharePoint and the 3rd scrippt above:
#Purpose: Creates Service Accounts
cd c:\SharePoint
.\sp2013serviceaccounts.ps1 -Level high ……

Does not work because there is no c:\SharePoint directory… I can’t just create it as it is supposed to have content. Did I miss a step or ?

sorry – found my error

Leave a Reply