Howdy! Welcome to my blog. I'm Cheng, and the objective of setting up this blog is to share stuff that I've learnt throughout my SharePoint journey. Stories that I shared here may or may not be of applicable to you today but please do come back should you encounter the same in future =)
It is always handy to have an automated script to perform task for you. Manual click vis SSMS could be tedious and prone to error.
I came out with a simple SQL which allow me to set recovery mode of all database in one instance to Simple or Full.
DECLARE @name varchar(255),@sql varchar (500)
DECLARE databases CURSOR FOR
SELECT name FROM sys.databases where name not in (‘master’,’tempdb’,’model’,’msdb’)
— Perform the first fetch.
FETCH NEXT FROM databases
— Check @@FETCH_STATUS to see if there are any more rows to fetch.
WHILE @@FETCH_STATUS = 0
— This is executed as long as the previous fetch succeeds.
SET @sql =
ALTER DATABASE [‘+ @name + ‘] SET RECOVERY SIMPLE;’
+ ‘DBCC SHRINKFILE([‘+@name+’_log], 1)’
FETCH NEXT FROM databases
Note that if you are doing Log Shipping, you need to use FULL recovery mode or Bulk-logged
First thing first, below are some files which you would need in order to setup your own SP2013 Environment. VMware Workstation 9 – here SharePoint 2013 – here SQL 2012 – here Windows 2012 Server – here Visual Studio 2012 – here Here we go.
Install VMWare Workstation on to your local PC, Ensure that your local PC has got at least 8 gb RAM. You would need to allocate some of the RAM to your 2012 server later.
Once completed the Workstation installation (i would not go through how you install software as it is simple), create a “New virtual machine“, choose Typical installation, PLEASE select option “I will install the operating system later“, else you will encounter error later. Then click Next until the vm files are created in your document folder “Documents\Virtual Machines\Windows Server 2012”
Before powering up your vm, please map your Windows Server 2012 ISO file to boot up and install.
Windows Server 2012
There is nothing much crucial to explain here. Just follow the setup wizard.
Once completed, you will be asked to enter the administrator password bla bla bla.
Remember to rename your windows name to something meaningful.. NOT Something like win-is2xx92243d which is totally making no sense. To configure this, go to Server Manager > Local Server > Click Computer Name > Change > Rename your server and click OK.
Restart your computer.
Next, it is always good to set your Server IP address. Though this is not actually required for a Single Box Setup. But good to learn? =) then
Next is to setup Active Director Domain Services (AD DS), this is required for you to create services account for sharepoint and sql later on. Note! dcpromo.exe isdeprecated for windows 2012. Sadly.
Kindly go to Server Manager > Dashboard > Add Roles and Features
Select Role-based or Feature-based installation
Select your server from the Server Pool list and click “Next”
Check on “Active Director Domain Services” check box, a prompt up will be displayed. Click “Add Feature”.
Now, click NEXT all the way down until the installation completed.
Promote Windows 2012 to a Domain Controller
Once your server 2012 is installed with AD DS, you have to promote your server to a domain controller.
In the Server Manager, you may notice this Alert icon. Click on it and click on “promote this server to a domain controller”.
In the “Active Director Domain Services Configuration Wizard”, Select Add a new forest, put your favorite name.
Click Next, leave the rest default and specify your DSRM Password
Click Next all the way down until you see “Install” button. Kindly ignore those warning message. Click Install. Reboot and you are done with DC Promo.
Now that your DC is up, you would need FEW accounts to setup your SharePoint 2013 environment. Note that i did not mention how many account required, because, ultimately, it depends on how segregated you want your farm to be. For Single Box solution and Less Error Prone. You may only need 3 accounts.
Open Run (Windows + R) then enter “dsa.msc” to open Active Director Users and Computers.
Right Click your Domain and add a new OU (this is my usual practice to park my sp account into an OU)
Add those 3 accounts.
Map your “SQLServer2012SP1-FullSlipstream-ENU-x64.iso” file to vm
Run the ISO file in your VM, Select Installation Tab on the left and click New SQL Server stand-alone installation or add features to an existing installation.
Click OK after the Setup Support Rules is completed, enter your product key (if you don’t have, use evaluation =D ), click OK. Include SQL Product Updates. Click OK~ These are pretty boring.
Next, select Role Mode. For evaluation purpose, i select All features with default.
Name your SQL Instance
Specify your services account. In my case, i use “SQL Server service account” that i have created previously.
Specify the Admin Account using the same SQL Server service account. account. (Well, this is for evaluation, you can still opt to use other account)
Analysis Configuration – Specify the same service account.
Distributed Replay Controller – Specify the same service account and the Controller Name as your Server Name
Click NEXT, NEXT, NEXT to install.. go get a coffee and come back after 30 mins…
OK~ Next thing is to setup permission for SharePoint Setup Account. Base on the article above. You have to grant the account (In my case “spsetup”) DBCreator and SecurityAdmin permission.
At this time, your server only allow Windows Authentication mode to access to your Database Engine. Please kindly Grant the SQLService account with Local Administrator right temporary. Log Off and switch to this account.
Open your SQL Management Studio, Login via Windows Authentication, Right click on the “Login” node and “New Login”
Select the SharePoint Setup Account “spsetup” and go to Server Roles. Check the 2 server roles “dbcreator” and “securityadmin”
Click OK to proceed.
For SharePoint 2013, there is one additional step is to change the Max Degree of parallelism to 1. Go to Database Engine, Right Click and Select Property. Under Advanced panel. Change the value to 1.
Click OK to proceed. Once this is completed, you may Switch User back to SharePoint Setup Account now (via Alt + Del + Insert) Note: Remove the SQLService account from local admin group once you are done with setting up the permissions.
Map your SP2013 iso file to your virtual machine (if you haven’t)
Go into your vm and install SP2013 pre-requisites. The next few steps are for Offline Pre-requisite installation.
Run Powershell with Administrator rights. Ensure you have executed the following command before Set-ExecutionPolicy RemoteSigned
Run the following command. Make sure the path is where you store the pre-requisite files. Also, copy the “prerequisiteinstaller.exe” from your SP2013 iso to the same folder where your script is located.
After 2 rounds of rebooting. The pre-requisite installation is finally done.
Open the SharePoint Installer Splash Screen and hit Install SharePoint Server.
Put in the Evaluation Product Key. NQTMW-K63MQ-39G6H-B2CH9-FRDWJ
Click Next until the installation is completed (yawn..)
Once the installation is completed, leave the check box default “Run SharePoint Products Configuration Wizard”. Close your installation wizard.
In the SharePoint Configuration Wizard, click Next.
System will prompt you to stop the 3 services account, IIS, SP Admin Service, SP Timer Service, click Yes to continue.
Select “Create a new server farm” and click OK.
At this point, you may want to setup an ALIAS for SQL connection. (Good practice!)
Fire Up “Run” and enter “cliconfg”.
Under Alias tab, enter “sql” name and select “TCP/IP” and your sql server name (basically the same server since we are setting up a single box server.)
Click OK and exit the CliConfg.
Back to the SharePoint Product Configuration Wizard, enter the ALIAS that you just created as the SQL name.
Next, specify the Login ID for “Server farm account or database access account” created earlier. (In my case “spfarm”).
Specify the passphrase and click Next
Specify the Central Admin port number and the authentication mode. Use NTLM for simplicity.
Click Next to start configuring. Again you can go get some drink and come back like 20 mins time
If you open your Task Manager, you will noticed that there is one new windows services running “AppFabric Service” which took you 300++mb of RAM. You may actually reduce the RAM usage to make room for other services. Refer here on how to reduce the AppFabric Memory Usage
Once you close the Product Configuration Wizard, IE will be fired up to performance Configuration. Select all services if you like. Also, you may use a separate service account for the services that you intend to add. I would not recommend turning on Search Service Application as this will take up A LOT OF YOUR MEMORY!!!! Please note. Do it only if you have a lot of RAM in your VM Host.
The Configuration may take quite some time. It happened to me before that it stuck forever. In case the screen doesn’t refresh or whatsoever, try to open the Central Admin again. The Services will still be created at the backend.
Create Site Collection
Once the Central Admin is done, you may proceed to create a Site Collection for your primary Web Application – 80
Click on “Create Site Collection” under Application Management tab.
Ensure the Web Application is selected correctly. Put in the Name and select your Site Template
Specify the Primary Site Collection Admin – AHCHENG\spsetup
Click OK!!! and Welcome to SharePoint 2013!
Note: If Newsfeed or MySite is having this “We’re almost ready!” error, please kindly check here to add your server as part of cache cluster