Stsadm to Windows PowerShell mapping

For the ones who are well versed with stsadm and switching to PowerShell, the following table provides a mapping of stsadm commands to their PowerShell counterparts

Stsadm operation Windows PowerShell cmdlet
Activatefeature Enable-SPFeature
Addalternatedomain New-SPAlternateUrl
Addcontentdb Mount-SPContentDatabase New-SPContentDatabase
Addpath New-SPManagedPath
Addpermissionpolicy None
Addsolution Add-SPSolution
Addtemplate Install-SPWebTemplate
Adduser New-SPUser
Addwppack Install-SPWebPartPack
Addzoneurl New-SPAlternateUrl
Authentication Set-SPWebApplication Use the AuthenticationMethod or AuthenticationProvider parameters.
Backup Backup-SPConfigurationDatabase Backup-SPFarm Backup-SPSite
Backuphistory Get-SPBackupHistory
Binddrservice None
Blockedfilelist None
Canceldeployment None
Changepermissionpolicy None
Copyappbincontent None
Createadminvs New-SPCentralAdministration
Creategroup None
Createsite New-SPSite
Createsiteinnewdb New-SPSite Use the ContentDatabase parameter. New-SPContentDatabase
Createweb New-SPWeb
Databaserepair None
Deactivatefeature Disable-SPFeature
Deleteadminvs None
Deletealternatedomain Remove-SPAlternateUrl
Deleteconfigdb Remove-SPConfigurationDatabase
Deletecontentdb Dismount-SPContentDatabase
Deletegroup None
Deletepath Remove-SPManagedPath
Deletepermissionpolicy None
Deletesite Remove-SPSite
Deletesolution Remove-SPSolution
Deletetemplate Uninstall-SPWebTemplate
Deleteuser Remove-SPUser
Deleteweb Remove-SPWeb
Deletewppack Uninstall-SPWebPartPack
Deletezoneurl Remove-SPAlternateUrl
Deploysolution Install-SPSolution
Deploywppack Install-SPWebPartPack
Disablessc None
Displaysolution Get-SPSolution
Email None
Enablessc None
Enumalternatedomains Get-SPAlternateURL
Enumcontentdbs Get-SPContentDatabase
Enumdeployments None
Enumgroups None
Enumroles None
Enumservices Get-SPServiceInstance
Enumsites Get-SPSiteAdministration (To run this cmdlet, you must be a member of the Farm Administrators group.) Get-SPSite (To run this cmdlet, you must be a local administrator on the computer where SharePoint 2010 Products is installed.)
Enumsolutions Get-SPSolution
Enumsubwebs Get-SPWeb
Enumtemplates Get-SPWebTemplate
Enumusers Get-SPUser
Enumwppacks Get-SPWebPartPack
Enumzoneurls Get-SPAlternateURL
Execadmsvcjobs Start-SPAdminJob
Export Export-SPWeb
Extendvs New-SPWebApplication
Extendvsinwebfarm New-SPWebApplicationExtension
Forcedeletelist None
Getadminport Get-SPWebApplication Use the following syntax:

  • Get-SPWebApplication -IncludeCentralAdministration | ? {$_.IsAdministrationWebApplication -eq $true} 
Getproperty Get-SPFarmConfig Get-SPTimerJob Disable-SPTimerJob Enable-SPTimerJob Set-SPTimerJob Start-SPTimerJob
Getsitelock Get-SPSiteAdministration
Geturlzone Get-SPAlternateURL
Import Import-SPWeb
Installfeature Install-SPFeature
Listlogginglevels Get-SPLogLevel
Localupgradestatus None
Managepermissionpolicylevel None
Mergecontentdbs Move-SPSite
Migrateuser Move-SPUser
Provisionservice Start-SPServiceInstance
Refreshdms None
Refreshsitedms None
Registerwsswriter None
Removedrservice None
Removesolutiondeploymentlock None
Renameserver Rename-SPServer
Renamesite Set-SPSite Use the Url parameter.
Renameweb Set-SPWeb Use the RelativeUrl parameter.
Restore Restore-SPFarm Restore-SPSite
Retractsolution Uninstall-SPSolution
Retractwppack None
Scanforfeatures Install-SPFeature Use the Scanforfeatures parameter.
Setadminport Set-SPCentralAdministration
Setapppassword None
Setconfigdb Connect-SPConfigurationDatabase
Setlogginglevel Set-SPLogLevel
Setproperty Set-SPFarmConfig Get-SPTimerJob Disable-SPTimerJob Enable-SPTimerJob Set-SPTimerJob Start-SPTimerJob
Setsitelock Set-SPSiteAdministration Use the LockState parameter.
Setworkflowconfig Set-SPWorkflowConfig
Siteowner Set-SPSiteAdministration
Spsearch Get-SPSearchService Set-SPSearchService Get-SPSearchServiceInstance Set-SPSearchServiceInstance
Spsearchdiacriticsensitive None
Syncsolution Install-SPSolution Use the Synchronize parameter.
Unextendvs Remove-SPWebApplication
Uninstallfeature Uninstall-SPFeature
Unregisterwsswriter None
Updateaccountpassword Set-SPManagedAccount
Updatealerttemplates None
Updatefarmcredentials None
Upgrade None
Upgradesolution Update-SPSolution
Upgradetargetwebapplication None
Userrole Get-SPUser Move-SPUser New-SPUser Remove-SPUser Set-SPUser

Complete reference of stsadm Commands

While searching over the net I came across a very useful post which lists all stsadm commands at one place. A handy link to have while working with stsadm commands

have a look here

There are no more files. (Exception from HRESULT: 0x80070012)

You restore a SharePoint Site using the stsadm restore command

stsadm –o restore –url http://yoursite -filename C:sitebackup.dat -overwrite

and then try to view the site in a browser…and then you are presented with this error page

There are no more files. (Exception from HRESULT: 0x80070012)

You keep scratching your head so as to what went wrong here???

Let me tell you this is because the restore command is not very well versed with restoring large backup files. And might not restore all the data. This error occurs because the default.aspx page of the site which was backed up was customized and the customizations are stored in database. But since the data in database was not restored the site does not work properly and hence the above error

Steps to resolve:
1.Open sharepoint site in designder
2.Right click on “default.aspx” and select “Reset to site definition”

Your site will start working but the customizations will be gone. You will need to do the customizations again 🙂

“Failure decompressing data from a cabinet file” error while saving a site as template

After you increase the size of site template using the following command

Stsadm.exe -o setproperty -pn max-template-document-size -pv 524288000 

to set the maximum template size to 500 MB. You might get an error “Failure decompressing data from a cabinet file”. It is a known issue from microsoft

Alternatively you can use import/export functionality of stsadm to serve your purpose

stsadm.exe -o export -url http://{yoursite} -includeusersecurity -nofilecompression -filename C:Mybackup

stsadm.exe -o import -url http://{yoursite} -includeusersecurity -nofilecompression -filename C:Mybackup