Advertisement
| 07.21.2008 at 01:54AM PDT, ID: 23581177 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: |
' Email source address
Const strFrom = "mossbackup@mymossserver.com"
'Email destination address
Const strTo = "michael@myownserver.com"
' Mail server address
Const strMailserver = "mymailserver.wan"
' Create variable used to contain the name of day
Dim varWeekDay
varWeekDay = (WeekdayName(Weekday(date)))
Set objShell = CreateObject("WScript.Shell")
' Obtain the path where stsadm is located on the server
Dim strRegKey
strRegKey = objShell.RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Location")
Dim strMOSSPath
strMOSSPath = strRegKey & "BIN\"
Dim strBackupLocation
strBackupLocation = "\\lanserver\SharepointBackup\" & varWeekDay
' Define the path to SharePoint Backup Restore Table file which contains
' crucial information regarding the outcome of the backup
Dim SharPointBackupRestoreTable
SharPointBackupRestoreTable = strBackupLocation & "\spbrtoc.xml"
Call deleteBackupFolder (strBackupLocation)
'Ensure the script runs in the SharePoint directory
objShell.CurrentDirectory = strMOSSPath
' Execute stsadm backup command
objShell.Exec ("stsadm -o backup -directory " & strBackupLocation & " -backupmethod full")
' This Do loop checks the status of the backup process every minute.
' If the backup process hasn't completed within 60 minutes an email is sent to the
' Sharepoint administrator notifying him/her about this, otherwise an email is sent
' notifying the SharePoint Administrator of the outcome of the backup
Do
loopCounter = loopCounter + 1
If count > 120 Then
Call SendEmail("SharePoint Backup Process exceeded 120 minutes", "SharePoint backup process has been running for over 120 minutes.Please check progress of backup")
End If
' Wait for 1 minute
WScript.Sleep 60000
' Check if the backup process (i.e. stsadm.exe) is currently running
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set sharepointProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'stsadm.exe'")
If (sharepointProcess.count) = 0 Then
' Backup process has ended therefore check the SharePoint Backup Restore Table to analyse the outcome of the backup
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load(SharPointBackupRestoreTable)
Set NodeList = objXMLDoc.documentElement.selectNodes("//SPErrorCount")
For Each Node In NodeList
If (Node.text) <> "0" Then
' Backup errors were generated
Call SendEmail("SharePoint backup Failed", "SharePoint backup failed with errors. Please investigate backup logs")
Else
' No backup errors were generated
Call SendEmail("SharePoint backup successfully completed", "SharePoint backup completed without errors")
End If
Next
Exit Do
End If
Loop
'Sends email with status of backups
Sub SendEmail (subject, body)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = strFrom
objEmail.To = strTo
objEmail.Subject = subject
objEmail.Textbody = body
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strMailserver
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
Call WriteEvent(subject,body)
End Sub
' Log the backup outcome to server application event log
Sub WriteEvent(subject,body)
If subject = "SharePoint backup successfully completed" Then
objShell.LogEvent 0, body
Else
objShell.LogEvent 1, body
end If
End Sub
Sub deleteBackupFolder (backupLocation)
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(backupLocation)) Then
' Delete existing backup folder
fso.DeleteFolder(backupLocation)
' Create new backup folder
fso.createFolder(backupLocation)
Else
' Folder not present therefore create new folder
fso.createFolder(backupLocation)
End If
End Sub
|
Advertisement