I’ve been wanting to release the SharePoint 2010 version of my STSADM extensions for quite some time but honestly just haven’t had the time to migrate as many as I would have liked. With over 145 STSADM extensions for SharePoint 2007 it was a challenge determining which ones I should focus on initially for the migration.
But today I’m happy to announce my initial release which contains 46 PowerShell cmdlets and 56 STSADM commands specific to SharePoint 2010. Yup, you read right, I’ve decided to maintain support for my STSADM commands and have been migrating them over as I create the equivalent replacement PowerShell cmdlet (though I recommend you don’t use them and suck it up and get used to PowerShell). You should note that there are more STSADM commands than PowerShell cmdlets – that’s because some of the things I was doing with STSADM can now easily be done with out of the box PowerShell cmdlets (I also have new PowerShell cmdlets that do not have an STSADM equivalent – everything new I create will be a cmdlet and I’ll create no new STSADM commands).
It’s going to take me a while to create all the posts needed to explain each cmdlet (assuming I create one at all) so for now I’ve created this simple table which lists all the STSADM commands and PowerShell cmdlets that are available in this initial release (I’ll eventually update my command index page but for now let this serve as the main reference for what is available as of 5/14/2010):
STSADM Commands | PowerShell Cmdlets | Notes |
---|---|---|
gl-activatefeature | Enable-SPFeature2 | There’s an OOTB Enable-SPFeature cmdlet, this one simple adds some capabilities which were present in my existing STSADM command. |
gl-addaudiencerule | New-SPAudienceRule | |
gl-addavailablesitetemplate | I’ll eventually create a cmdlet for this. | |
gl-adduser2 | Use the OOTB New-SPUser cmdlet. | |
gl-adduserpolicyforwebapp | Add-SPWebApplicationUserPolicy | |
gl-applytheme | This can be done pretty easily using Get-SPWeb and the ApplyTheme() method of the SPWeb object. | |
gl-backup | Use the OOTB Backup-SPFarm and Backup-SPSite cmdlets. | |
gl-backupsites | Backup-SPSite2 | Extends Backup-SPSite by including IIS settings. |
gl-convertsubsitetositecollection | ConvertTo-SPSite | |
gl-copycontenttypes | Copy-SPContentType | |
gl-copylist | Copy-SPList | |
gl-copylistsecurity | Copy-SPListSecurity | |
gl-createaudience | New-SPAudience | |
gl-createcontentdb | Use the OOTB New-SPContentDatabase cmdlet. | |
gl-createpublishingpage | New-SPPublishingPage | |
gl-createquotatemplate | New-SPQuotaTemplate | |
gl-createwebapp | Use the OOTB New-SPWebApplication cmdlet | |
gl-deactivatefeature | Disable-SPFeature2 | Extends the OOTB Disable-SPFeature cmdlet. |
gl-deleteallusers | I probably won’t replicate this as it is easily done using the OOTB Remove-SPUser cmdlet. | |
gl-deleteaudience | Remove-SPAudience | |
gl-deletelist | Remove-SPList | |
gl-deletewebapp | Use the OOTB Remove-SPWebApplication cmdlet. | |
gl-disableuserpermissionforwebapp | This is fairly easy to do OOTB so I may not create a cmdlet for it. | |
gl-editquotatemplate | Set-SPQuotaTemplate | |
gl-enableuserpermissionforwebapp | This is fairly easy to do OOTB so I may not create a cmdlet for it. | |
gl-enumaudiencerules | Export-SPAudienceRules | |
gl-enumavailablepagelayouts | Get-SPPublishingPageLayout | |
gl-enumavailablesitetemplates | Get-SPAvailableWebTemplates | |
gl-enumeffectivebaseperms | This is fairly easy to do OOTB so I may not create a cmdlet for it. | |
gl-enumfeatures | Use the OOTB Get-SPFeature cmdlet. | |
gl-enuminstalledsitetemplates | Use the OOTB Get-SPWebTemplate cmdlet. | |
gl-enumpagewebparts | Get-SPWebPartList | |
gl-enumunghostedfiles | Get-SPCustomizedPages | |
gl-execadmsvcjobs | Start-SPAdminJob2 | I honestly need to research this a bit more as I’m not sure it’s necessary anymore but I’ve replicated the functionality in case someone finds it useful. |
gl-exportaudiences | Export-SPAudiences | |
gl-exportcontenttypes | Export-SPContentType | |
gl-exportlist | Export-SPWeb2 | I’ve just extended the Export-SPWeb2 cmdlet to add additional parameters. |
gl-exportlistsecurity | Export-SPListSecurity | |
gl-extendwebapp | Use the OOTB New-SPWebApplicationExtension cmdlet. | |
gl-fixpublishingpagespagelayouturl | Repair-SPPageLayoutUrl | |
gl-importaudiences | Import-SPAudiences | |
gl-importlist | Import-SPWeb2 | I’ve just extended the Import-SPWeb2 cmdlet to add additional parameters. |
gl-importlistsecurity | Import-SPListSecurity | |
gl-listaudiencetargeting | Set-SPListAudienceTargeting | |
gl-managecontentdbsettings | Use the OOTB Set-SPContentDatabase cmdlet. | |
gl-propagatecontenttype | Propagate-SPContentType | |
gl-publishitems | Publish-SPListItems | |
gl-reghostfile | Reset-SPCustomizedPages | |
gl-removeavailablesitetemplate | I’ll eventually create a cmdlet for this (maybe). | |
gl-repairsitecollectionimportedfromsubsite | Repair-SPSite | |
gl-replacewebpartcontent | Replace-SPWebPartContent | |
gl-setbackconnectionhostnames | Set-SPBackConnectionHostNames | |
gl-setselfservicesitecreation | Not sure if I’ll migrate this or not. | |
gl-syncquotas | Set-SPQuota | |
gl-tracelog | Use the OOTB Set-SPDiagnosticConfig cmdlet. | |
gl-unextendwebapp | Use the OOTB Remove-SPWebApplication cmdlet. | |
Get-SPAudience | ||
Get-SPAudienceManager | ||
Get-SPContentType | ||
Get-SPFile | ||
Get-SPLimitedWebPartManager | ||
Get-SPList | ||
Get-SPPublishingPage | ||
Get-SPQuotaTemplate | ||
Set-SPAudience |
For those that know a thing or two about cmdlet development you might be
interested in knowing that I am dynamically generating the help XML file for the cmdlets. If you download the source you’ll find a class which uses reflection to interrogate the assembly and dynamically build the help file just prior to building the WSP package. This saved me literally days of hand editing XML.
You can download the source and WSP files here or from the Downloads page:
After you deploy the package you can type help <cmdlet name>
to get detailed help about each cmdlet, including parameter descriptions and example usage. If you want to see the list of cmdlets installed type the following:
1gcm | where {$_.DLL –like "*lapointe*"}
As always, your use of these cmdlets/stsadm commands is at your own risk – I do as much testing as I can but every environment is different and there’s simply not enough time in a day. If you have any suggestions or feedback please don’t hesitate to leave a comment – I appreciate all of them!