Powershell

STSADM equivalent Powershell Commands

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…

Managing Sharepoint Timer Jobs using PowerShell

#function to enable the timer job if its disabled function EnableTimerJobIfDisabled ( [String]$TimerJobName) { [void][System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”) if(CheckTimerJobStatus) { Get-SPTimerJob $TimerJobName Enable-SPTimerjob -Identity $TimerJobName write-host “Enabled $TimerJobName” } }      #### Enable Timer Job #### #Enable the timer job if it…

Powershell script to Restore the SharePoint Site Content Types From XML File

$destWeb = Get-SPWeb http://34.231.97.77 #$xmlFilePath = “C:\Install\ScriptDocument.xml”     Function CreateCTypes($xmlFilePath) { #Create Site Content Types $ctsXML = [xml](Get-Content($xmlFilePath)) $ctsXML.ContentTypes.ContentType | ForEach-Object {     #Create Content Type object inheriting from parent $spContentType = New-Object Microsoft.SharePoint.SPContentType ($_.ID,$destWeb.ContentTypes,$_.Name)   #Set Content…

Powershell script to Backup the SharePoint Site Content Types To XML File

$sourceWeb = Get-SPWeb http://34.231.97.77 #$xmlFilePath = “C:\Install\ScriptDocument.xml”     Function BackupCType() { param ($CTypeName, $xmlFilePath) #Create Export File New-Item $xmlFilePath -type file -force #Export Content Types to XML file Add-Content $xmlFilePath “<?xml version=`”1.0`” encoding=`”utf-8`”?>” Add-Content $xmlFilePath “`n<ContentTypes>” $sourceWeb.ContentTypes | ForEach-Object…

Setup outgoing Email Configuration for SharePoint Using Powershell

Add-PSSnapin Microsoft.SharePoint.PowerShell $SMTPSvr = ‘smtprelay.domainname.com’ $FromAddr = ‘noreply@.domainname.com’ $ReplyAddr = ‘noreply@domainname.com’ $Charset = 65001 $CAWebApp = Get-SPWebApplication -IncludeCentralAdministration | Where { $_.IsAdministrationWebApplication } $CAWebApp.UpdateMailSettings($SMTPSvr, $FromAddr, $ReplyAddr, $Charset)

Bitnami