"The day you stop learning SharePoint is the day you stop using it."

STEPS TO AUTOMATE BACKUP OF SHAREPOINT 2010 SITE COLLECTION

1.     Open the notepad and copy the below script.

Add-PsSnapin Microsoft.SharePoint.PowerShell
Start-SPAssignment -Global

$mySite="http://sitecollectionURL"
$backupLocation="D:\SiteBackup"
$logFile="$backupLocation\BackupLog.log"
$today=Get-Date -format "MM-dd-yyyy HH.mm.ss"

try
{
Backup-SPSite $mySite -Path $backupLocation\SPSite_$today.bak -force
write "$today $mySite successfully backed up">>$logFile   
}

catch
{
write-Host Backup process failed
See $logFile for more information.    
write "$today  Error: $_">>$logFile
}   

Stop-SPAssignment -Global
Remove-PsSnapin Microsoft.SharePoint.PowerShell
write-Host "Task Finished"
  • In the script specify your site collection url at variable $mySite =”http://sitecollectionURL
  • Specify the backup location at variable $backupLocation="D:\SiteBackup"
  • Create a Backup log text file in the same backup location with the name “BackupLog”
  • Provide an appropriate name for the file and save the file with a “.ps1” extension.
You can repeat the process from step 1 to 5 for different site collections. In this way you can have multiple PowerShell scripts for every site collection.
Or you can declare new variables like,
$mySite1=http://siteURL1”         
$mySite2=http://siteURL2

And add additional Backup-SPSite command in the above script.
Example:
Backup-SPSite $mySite1 -Path $backupLocation\Site1_$today.bak –force
                Backup-SPSite $mySite2 -Path $backupLocation\Site2_$today.bak –force 

Example:

Add-PsSnapin Microsoft.SharePoint.PowerShell
Start-SPAssignment -Global

$mySite1=”http://site1.domain.com
$mySite2=”http://site2.domain.com
$mySite3=”http://site3.domain.com
$mySite4=”http://site4.domain.com
$backupLocation="D:\SiteBackup"
$logFile="$backupLocation\BackupLog"
$today=Get-Date -format "MM-dd-yyyy HH.mm.ss"

try
{
Backup-SPSite $mySite1 -Path $backupLocation\Site_IAM_$today.bak –force
write "$today   $mySite1 successfully backed up.">>$logFile   

Backup-SPSite $mySite2 -Path $backupLocation\Site_ArtWork_$today.bak –force
write "$today   $mySite2 successfully backed up.">>$logFile   

Backup-SPSite $mySite3 -Path $backupLocation\Site_ContractsDB_$today.bak –force
write "$today   $mySite3 successfully backed up.">>$logFile   

Backup-SPSite $mySite4 -Path $backupLocation\Site_Partners_$today.bak –force
write "$today   $mySite4 successfully backed up.">>$logFile   
}

catch
{
write "$today    Error: $_">>$logFile
}   
Stop-SPAssignment -Global
Remove-PsSnapin Microsoft.SharePoint.PowerShell

Now schedule the backup task to automate and execute it whenever you require such as daily, weekly, monthly or yearly using Task Scheduler.
  • Start the Windows Task Scheduler by clicking on Start -> Administrative Tools ->Task Scheduler.
  • From Actions, select Create Task.
  • Under the General Tab, provide a name and a description (Ex: Backup of SharePoint Sites….) and choose the “Run whether user is logged on or not” and check the “Run with highest privileges” checkbox.
  • Under the Triggers tab, click New and schedule a Daily or as often as you like to run the task and click OK.
  • Under the Actions tab, click New and keep the Action parameter as Start a program. In the Program/script textbox type powershell.exe and next to Add arguments textbox, provide the path of your script file location (Ex: D:\SPBackup\SPSite_Backup.ps1) click OK and provide the credentials of FARM Admin or at least Site Collection Administrator when prompted.

Share:

Security Token Service not responding in Project Server 2013

I was facing a serious issue from past couple of days… The Project Server 2013 Web App was inaccessible. After monitoring ULS logs and Event Viewer, following exceptions I encountered. These exceptions were continuously occurring and I was not able to find the root cause. Hence after consulting Microsoft Support team, we both managed to get rid of the exceptions and finally the Project Server Web App was accessible.

The HTTP service located at http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc is unavailable.  This could be because the service is too busy or because no endpoint was found listening at the specified address. Please ensure that the address is correct and try accessing the service again later.

Application pool ‘SecurityTokenServiceApplicationPool’ is being automatically disabled due to a series of failures in the process(es) serving that application pool.

Event 8306 (SharePoint Foundation) of severity ‘Error’ occurred 58 more time(s) and was suppressed in the event log.

Event 6398 (SharePoint Foundation) of severity ‘Critical’ occurred 8 more time(s) and was suppressed in the event log.


Analysis:
Based on the error message: “A listener channel for protocol ‘HTTP’ in worker process ‘5532’ serving application pool ‘SecurityTokenServiceApplicationPool’ reported a listener channel failure.  The data field contains the error number.” and error message:” The Module DLL ‘C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\isapi\spnativerequestmodule.dll’ could not be loaded due to a configuration problem. The current configuration only supports loading images built for a x86 processor architecture.” The issue is probable caused by the failure during the loading of spnativerequestmodule.dll file.

Resolution:
Navigate to IIS Manager-> Application Pools-> right click the ‘SecurityTokenServiceApplicationPool’ and choose “Advanced Settings”. If “Enable 32-Bit Applications” is set to “true”, please set it to “false”, reset IIS and your are done !!
Happy accessing Project Server Web App… :)
Share:

Author's Profile

My photo
India
A SharePoint Enthusiast working as a Project Lead for an IT Software & Consulting Company in Mumbai. I believe in giving back to the community through which I also learn and develop and eventually grow as an individual and professional. This blog is a small contribution to the community where I live in and may help someone who is seeking knowledge like me. Apart from being a SharePoint Enthusiasts, I am a husband, a father and a blogger. I love to travel and explore new landscapes and meet people of various culture. I am passionate about learning new technology trends in IT. I love spending time on my fitness and have a deep enthusiasm for urdu poetry and career counseling.

Popular Posts

Powered by Blogger.

Contact Form

Name

Email *

Message *

Total Pageviews