Hello, welcome to today’s video. My name is James Olorunosebi, and I will be your guide for this video tutorial. Today we are going to be looking at Understanding Site Collections and this is the second and last part. So right now what we are going to do is, we are going to create a couple of web applications, and in those web applications we are going to create a couple of site collections, and in those site collections we are going to create a couple of sub-sites, and after doing that we are going to quickly use the PowerShell command lines; the Get-SPWebApplications and the Get-SPSite, and Get-SPWeb to query this SharePoint farm and see the results that we get.

MCSE Training – Resources (Intense)

We are going to work with our company, our organization, we are going to assume that our organization is divided into divisions, and each of those divisions have a pretty large setup within themselves. So for starters on this, we are going to create a web application for Finance. We are going to create another web application for HR. We are going to create another web application finally for, say Geology. And in Finance for example we are going to break it down into three other sub-sites (site collections). And for HR we are going to create for three other sub-sites (site collections). And for Geology, now I don’t know why using geology am, but okay. We are going to have this structure. So let’s get right into it.

To create the web applications that we need, we need to go into Central Administration, and in Central Administration we need to go into Manage Web Application. And now this is the Manage Web Application page. We are going to go over here, and we are going to choose the option to create a New Web Application. We are going to do this pretty fast and set the options that we need. Okay, so now this is the option to create a new web application. We are going to choose Create a new IIS Web Site. It’s going to choose some port already, we are not going to mess around with the port numbers that it is using, and we are going to leave it as it is, except in your design document when you had series of meetings in your department with your other IT staff or your tech team where you have decided to use specific ports, other than that, you can just pretty much leave the port numbers alone. You have quite a huge pool of port numbers to select from. Okay, so we are going to leave this alone. Enable Windows Authentication. We are going to leave it, accept all the defaults. It’s going to Create new application pool, for this web application which is fine, and we are going to accept this, it is okay. Now the content database name that it’s going to create for this web application is WSS_Content_this strings. Now if you don’t want to use this strings, you can change this, and since this is the first one for Finance, am going to put WSS_Content_Finance. It’s good to use naming conventions that you can easily use to identify the content databases when you go into SQL Server, rather than accept the strings of numbers and letters that it’s giving you by default. So we scroll down, these services will be applied, and we click OK out of here, and the web application is created for that division. Okay let’s create a new web application now. We click on New, we don’t need to change anything, we just scroll down and change the content database name, and we OK out of there as well, and that’s created and we OK out of here too. Then we create a new one as well which is the last one, the third one, and scroll down, change the content database name once again, to Geology. We OK out of there, and voila! So it’s all ready. What we are going to do now is go into SQL Server, and see if we can identify and find these content databases that we just created using the web application console page. So we expand databases over on this side, and there they are at the bottom – WSS_Content_Finance, WSS_Content Geology, WSS_Content_HR.

So we are going to come back to the desktop now, I have this notepad file I have on the desktop, and am just going to launch it. Okay, now what I have done is to prepare this, and a little bit of panning has gone into this. What we are going to do is, remember earlier we had created these web applications for HR, Finance and Geology, and we just did that, and we named them based on the relevant content databases that we need them to be. What we are going to do is that we are going to populate these web applications with the site collections that they are supposed to have. So these are the site collections that we are going to be creating. For HR we are going to create these site collections, Recruitment, Benefits, and Training. And for Finance we are going to create Audit, Assets, and we are going to create the Tax. In Geology we will have Exploration, Research, and Projects. And the command line syntax we are going to use is what we have here. So for the first part, this command line syntax will get the templates (Get-SPWebTemplate). This next one will load the template ($template = Get-SPWebTemplate “STS#0”). And then the last part of it which is Then execute this (shown on screen) is what we are going to use to actually carry out the actual creation. So what we have here is this string here, is for the creation itself, it will create the URL for the site collection. And as it loads the template to create that URL, it’s going to give it this name because of the syntax –Name, and this is the description we are going to attach to that name. And over here we have the owner which is the Site Collection Administrator name. And this is the site collection administrator’s email that he is going to use to receive notifications to join or to leave the site. And this template that was loaded into memory is going to be applied for this creation.

To execute this now, we are going to open PowerShell, we go to Start menu, All Programs, go to the SharePoint 2013 Products, and expand that and then we are going to select the SharePoint 2013 Management Shell, this will bring out the PowerShell window for us to use to execute this tasks. So, let’s copy the first syntax which is to get the templates, and we are going to paste that, execute and we are going to wait for that to run. Okay, there are all the SharePoint site collection templates that are available. So we are going to scroll to the top, and we are going to use the first one, the “STS#0”, we are going to use that, so let’s copy this second one, paste it in here, execute, and so that template is loaded into memory. Voila, that’s complete. We going to now copy the syntax at the bottom, and that’s what we are going to edit.

New-SPSite –URL http://sps-sqldb:21321/sites/audit -Name “AUDIT DEPARTMENT” –Description “The Audit Department team site” –OwnerAlias “TESTLAB\john.doe” –OwnerEmail john.doe@testlab.com –Template $template

Now currently this has been used to create the Audit department’s site collection that has been used already, so we don’t need to recreate that, so we going to edit this to meet our requirement for HR. So we are going to create the first one for Recruitment. We are going to edit this string let fit into recruitment, or let recruitment fit into it. Okay so that is the port number, we are going to edit it on this side, delete this, and we type in that port number. We come to the audit string we change that. Recruitment, yes. We change the description, we edit the description, and that does it. So we can execute this. We wait for that to run.

Now, I did this deliberately, if you run into this error, you can pause this video, if you run into this error, what you should do is, it is actually telling us like what we have seen in our other videos that our domain controller is down. So we need to power that up. Okay, so let’s power up our domain controller, and once it’s up and running, you just need to come back into the command line window, and re-run the syntax again, execute, and that will be fine. Okay, so this has been created now. So we have a recruitment site collection created. What we are going to do now is verify that this site actually has been done. We go to our browser, so we just change the web application because the web application we used is different from what is showing now, so we change to the web application into which we created that site collection, which is 17436, we load that, and we should see recruitment at the bottom. There it is, there is recruitment. So what we are going to do now is we are going to copy the recruitment site collection URL over here. Yes, so we copy that, okay, and we open another tab, and we paste the URL into this address bar. There you go, it executes, and we wait for the site to load up. Excellent. So there it is, recruitment department has been created with John Doe as the Site Collection Administrator, and with John Doe as the person who will receive the email notifications as well. Okay, so now we are going to do this now for every other site, and we are going to use the SPWeb and SPSite syntax to iterate all the sites and web applications that we have in our SharePoint farm. So as soon as am done creating everything, we’ll just do that.

Okay so welcome back, what we have done is, I have executed this command and we have created all of these site collections. We are just going to scroll down here a little bit more, and we’re going to execute these two lines here to get our web applications listings. I am just going to copy this, and I am just going to paste it right over here, and hit ENTER, okay, so we have all our web applications listed, and their URL. Cool. And the next thing, we are going to do this one, and now it is iterating all our site collections. So Audit, Benefits, Recruitment, Training, Assets, Audits, Tax, Exploration, Projects, Research, and the Testlab intranet. This is how we use PowerShell to work with our SharePoint site collections, and now, this is actually way neater than finding your way through the browser and trying navigate through Central Admin to find what web application is in what, and what site collection is in what web application? It can be really tedious. Sometimes you might need to quickly come up with a list of this sites if you are in an environment where there are so many site collections, or so many web applications, and time is not your friend, and you just need to quickly come up with this list, to submit it probably to your team lead, or to another team, or for whatever purpose you want to use it for, this is a very good way to get all of that information out.

Thank you for watching Understanding Site Collections Part 2, see you again next time, in another part of the video series.