Creating a SharePoint 2010 Site Structure Using PowerShell

Posted on 14 CommentsPosted in Scripts, SharePoint 2010

In a previous post I detailed how to use PowerShell to perform what would be otherwise done using PSConfig to create an initial SharePoint Farm. In this post I will continue the example and show how to create your web applications using a simple XML configuration file and a reusable script. Like the previous example I have a very basic XML file that defines my web application structure. In this example I’ve included not only […]

Custom SharePoint 2007 Site Collection Creation Page

Posted on 19 CommentsPosted in Article, SharePoint 2007

A lot of people that are using SharePoint 2007 (WSS or MOSS) for collaboration have either enabled self service site creation in which they allow their end-users to create a page using the scsignup.aspx page or they have some process in place in which an IT administrator creates site collections for their users.  Usually companies go the later route due to limitations with the self service site creation process; specifically, you cannot have the site […]

Creating Default Site Groups After Creating Site Collections Using STSADM

Posted on 2 CommentsPosted in SharePoint 2007, STSADM Commands

I got an email from Jennifer Davis today asking why, when she ran my gl-createsiteindb command, did the default site groups not show up in the site collection, specifically the “<site name> Members”, “<site name> Owners”, and “<site name> Visitors” groups.  Upon digging further she realized that this behavior was not limited to my command as the out-of-the-box createsite and createsiteinnewdb commands exhibited the same behavior. Basically what’s happening is that if you create the […]

Why I don’t use OpenWeb()

Posted on 14 CommentsPosted in Article, SharePoint 2007

This has come up in various conversations recently so I figured I’d write up a short post about it.  When trying to obtain an SPWeb object there are a couple of different options available using members of an SPSite instance.  The first, and more common, is the OpenWeb() method and the second is using the AllWebs[] property collection.  Here’s the problem I have with OpenWeb() (specifically the overload that takes no arguments) – consider the […]

Working with SPSite(Info) Objects Using PowerShell

Posted on 6 CommentsPosted in PowerShell Cmdlets, SharePoint 2007

One of the first PowerShell cmdlets I built, Get-SPSite, addresses some common issues found with working with SPSite objects.  I struggled with how I could provide a means to quickly and easily get SPSite objects while at the same time helping administrators so they don’t have to worry (as much) about object disposal.  For those that aren’t familiar with the SPSite object (Microsoft.SharePoint.SPSite), it’s the equivalent programmatic element for working with site collections. What I […]

Recalculating Usage Statistics via STSADM or PowerShell

Posted on 8 CommentsPosted in PowerShell Cmdlets, SharePoint 2007, STSADM Commands

I was perusing through the SharePoint forums the other day and I came across an issue that someone was having with the usage statistics information for their My Sites site collections.  When they viewed the usage data (~site/_layouts/usage.aspx) they were seeing incorrect information.  I’m not really sure why the numbers were wrong but fixing them turned out to be pretty easy.  There’s a public method called “RecalculateStorageUsed” that, when called, will recalculate the usage statistics […]

Delete All Users from a Site Collection

Posted on 23 CommentsPosted in SharePoint 2007, STSADM Commands

I was chatting with my buddy and fellow MVP, Todd Klindt, the other day and he was asking if I had a custom command that would allow him to quickly delete all the users added to a site collection.  For his purposes he needed this to troubleshoot an issue he was having with a site collection that contained many thousands of users. I figured this would be pretty easy to do – a simple while […]

Set Anonymous Access

Posted on 9 CommentsPosted in SharePoint 2007, STSADM Commands

If you’re trying to configure a site for anonymous access via stsadm you can get most of the way using the out of the box "extendvs" (or my createwebapp) and "authentication" commands. The problem is that this only enables the web application for anonymous access but it doesn’t "turn it on" at the site collection or web level. To complete the process I created a new command: gl-setanonymousaccess. There are three levels that you can […]

Create Site in Database

Posted on 34 CommentsPosted in SharePoint 2007, STSADM Commands

So you’ve got a content database (perhaps you used the gl-createcontentdb command) and now you want to create a site collection in that database. Problem is that you can’t do this easily via the browser and you definitely can’t do it via stsadm. There is a createsiteinnewdb command and a createsite command but the first will create a new database and the second will put the site collection in the "best match" database. But you […]

Set the Welcome Page for a Web

Posted on 4 CommentsPosted in SharePoint 2007, STSADM Commands

When I did the gradual upgrade I found that several sites had the welcome page set to UpgLandingPgRedir.aspx when it should have been set to default.aspx. I didn’t have time to figure out why it was doing this but the fix was easy enough – I just had to change the welcome page back. To do this I created a new command: gl-sitewelcomepage. The code to set this is really simple – basically just get […]