Working with SPWeb(Info) Objects Using PowerShell

Posted on 5 CommentsPosted in PowerShell Cmdlets, SharePoint 2007

I know, I know, I’m way behind on documenting my PowerShell cmdlets – I will be striving to get them done as soon as possible.  I’ve already documented one of them, the Get-SPSite cmdlet, and I will now continue with the Get-SPWeb cmdlet.  Hopefully I’ll be able to wrap up the others much quicker as they are a lot simpler – then I can finally start building new ones 🙂 Like the Get-SPSite cmdlet 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 […]

Listing Event Receivers using STSADM

Posted on Leave a commentPosted in SharePoint 2007, STSADM Commands

This post wraps up my event receiver posts.  I just finished documenting the gl-addeventreceiver and gl-deleteeventreceiver commands and this final command would be gl-enumeventreceivers. This command is the simplest of the three as it’s just looping through all the event receivers belonging to the specified target and dumping the results out as XML.  I’ve tried to structure the XML so that it conforms to the CAML schema therefore allowing the results to be put into […]

Deleting an Event Receiver using STSADM

Posted on Leave a commentPosted in SharePoint 2007, STSADM Commands

I had some time so I decided to add the counterparts to the gl-addeventreceiver command that I just published.  I created two new commands, gl-deleteeventreceiver and gl-enumeventreceivers.  This post will cover the delete command and I’ll go over the enum command in my next post. From a code perspective the delete command is very similar to the add command.  The main difference (aside from the obvious call to Delete instead of Add) is that I’ve […]

Adding Event Receivers using STSADM

Posted on 1 CommentPosted in SharePoint 2007, STSADM Commands

A few months ago I created a CodePlex project that allows you to configure a library to allow the storing of web part page history.  The project at its core used three item event receivers to listen to certain key events and either backup the page or restore the page based on the event.  Recently I was thinking about what might be the best way to allow people to script the settings that enable the […]

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 […]

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 […]

Apply Theme

Posted on 15 CommentsPosted in SharePoint 2007, STSADM Commands

This command came about as a result of wanting to be able to reset the theme of a web site when it was upgraded. I had created this code as part of the upgrade2 command and figured that I might as well pull it out into its own command so that it could be used independently of the upgrade command. I called this command gl-applytheme. Setting the theme is really simple – you just call […]

A Better Delete Web

Posted on 24 CommentsPosted in SharePoint 2007, STSADM Commands

I recently had to use the built-in deleteweb command to delete a web site and was irritated to find that the command wouldn’t let me delete the web because it had sub-webs. I simply couldn’t live with that as it’s extremely frustrating to have to delete all the child webs one at a time. So I created a better deleteweb command, called simply gl-deleteweb2. It behaves exactly like the built-in deleteweb command except that you […]

Move Web

Posted on 52 CommentsPosted in SharePoint 2007, STSADM Commands

As part of my upgrade I’ve got several hundred web sites that need to be moved around (either from one web application to another or just to a different location with the same web app or site collection). I figured that I needed an easy way to do this – the usual way is to either use the browser and go to the content and structure page to move webs around within a site collection […]