Sharepoint 2010 üzerinde dosya sunucusu olarak bir site oluşturduğumuzda eğer site quota üzerinde değişiklik yapmazsak bir süre sonra belge yükleme işlemini yapamaz hale gelebiliriz. “Bu denetim şu anda devre dışı” uyarısı alırız ve aşağıdaki ekranla karşılaşabiliriz.
Çözüm için Central Administration altından Application Management’a girilir. Burada configure quotas and locks‘a girilir ve burada Site Lock Information kısmından Lock status Not locked seçilir.
Sharepoint serverımızı eğer dosya sunucu olarak kullanıyorsak, default gelen maximum dosya upload sınırını olan 50 MB’ı değiştirmek gerekecek. Bunu Sharepoint Central Administration>Application Management>Manage Web Applications > General Settings ayarlarında Maximum Upload Size değerini değiştirebilirsiniz.
Bu şekilde ayarları değiştirebildiğiniz gibi aynı işlemi powershell üzerinde aşağıdaki komutlar ile de yapabilirsiniz.
$webapplication=Get-SPWebApplication http://serverurl
$webapplication.MaximumFileSize=300
$webapplication.Update()
Sharepoint 2010 yedeğini central administration üzerinden yapabildiğimiz gibi, bunu script oluşturarak schedule task ile zamanlı backup alabiliriz. Bunun için ilk önce BackupSite.ps1 isimli bir dosya oluşturup aşağıdakileri dosyaya kaydederiz. Burada dikkat etmeniz gereken yerler kırmızı işaretli olan alanlardır. Buraya kendi bilgilerinizi girmeniz gerekir.
Add-PsSnapin Microsoft.SharePoint.PowerShellStart-SPAssignment -Global # Backup icin powershell komutu$mySite=”http://siteadı” # Burayi sitenizin ismi ile degistirin$backupLocation=”F:\SPYEDEK\” # Burasi sharepoint yedegini alacaginiz yeri belirtiyor.$logFile=”$backupLocation\BackupLog.log” # Burasi backup logunun tutultugu yer.$today=Get-Date -format “MM-dd-yyyy HH.mm.ss” # Get current date and format it to avoid invalid characters such as “/”, “:”write-Host Start backing up $mySite to $backupLocationtry{# Create a new backup file based on current date. If you want to create only 1 backup file and overwrite it each time the backup is run, you can replace “$today.bak” with your desired file name.Backup-SPSite -Identity $mySite -Path $backupLocation\$today.bak -force -ea Stopwrite-Host Backup succeeded.# Write success message to the log filewrite “$today $mySite successfully backed up.”>>$logFile}catch # If the process failed{write-Host Backup failed. See $logFile for more information.# Write error message to the log filewrite “$today Error: $_”>>$logFile}Stop-SPAssignment -GlobalRemove-PsSnapin Microsoft.SharePoint.PowerShellwrite-Host “Finished script.”Add-PsSnapin Microsoft.SharePoint.PowerShell
Start-SPAssignment -Global # This cmdlet takes care of the disposable objects to prevent memory leak.
$mySite=”http://avmserver” # Replace with your site collection URL$backupLocation=”F:\SPYEDEK\” # Replace with your backup location$logFile=”$backupLocation\BackupLog.log” # Replace with your desired log file location
$today=Get-Date -format “MM-dd-yyyy HH.mm.ss” # Get current date and format it to avoid invalid characters such as “/”, “:”
write-Host Start backing up $mySite to $backupLocationtry{ # Create a new backup file based on current date. If you want to create only 1 backup file and overwrite it each time the backup is run, you can replace “$today.bak” with your desired file name. Backup-SPSite -Identity $mySite -Path $backupLocation\$today.bak -force -ea Stop
write-Host Backup succeeded.
# Write success message to the log file write “$today $mySite successfully backed up.”>>$logFile }catch # If the process failed{ write-Host Backup failed. See $logFile for more information.
# Write error message to the log file write “$today Error: $_”>>$logFile}
Stop-SPAssignment -Global
Remove-PsSnapin Microsoft.SharePoint.PowerShell
write-Host “Finished script.”
Powershell scripti çalıştırmak için aşağıdaki batch file dosyasını oluşturuz.
cd /d %~dp0
del *.bak -y
powershell -file “.\BackupSite.ps1”
Yukarıdaki yazıları RunBackup.bat isimli dosya oluşturup içine kopyalarız ve backup scriptimiz hazır olur. Bu dosyayı schedule task’a ekleyip günlük olarak backubımızı aldırabiliriz.