Question : sbs 2008 script problem

Hi all,
I am trying to write a vbscript to automatically backup my Sharepoint. I am testing it by opening a command prompt as administrator and then running the script. The script correctly creates the backup sub-directory however, it doesn't appear to launch stsadm as it doesn't create any backup files and it doesn't show as running in Taks manager - All Users.

How can I test this script and ensure it works? I have attached the script incase i made an error in it.
Thank you.
Code Snippet:
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:
' Description:
' Tool for planning and automating files/entries
' Microsoft Office SharePoint Server 2007
'
' Will generate file entry names with the following style: YYYYMMDD
' E.g.: 20070228

Option Explicit

Const BackupPath = "D:\SharePoint_Backup\"
Const C_SiteURL = "http://companyweb"
Const C_NamePrefix = "SharePoint_"
Const C_SharePointBin = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Bin"

Dim fso, folder, filedate, f, file, filesys
Dim sBackupPrefix

set filesys=CreateObject("Scripting.FileSystemObject") 
Set fso = CreateObject("Scripting.FileSystemObject")

if Not fso.FolderExists(BackupPath) then
WScript.Echo "The folder " & BackupPath & " does not exist!"
WScript.Quit
end if

Set folder = fso.GetFolder(BackupPath)
filedate = now
Set f = Nothing

' Assigns a name of the new file
sBackupPrefix = BackupPath & year(now) & right("00" & Month(now),2) & right("00" & day(now),2)

Set folder = filesys.CreateFolder(sBackupPrefix)

Dim objShell
Dim strcmd

Set objShell = CreateObject("WScript.Shell")
'msgbox ("C_SiteURL = " & C_SiteURL & ", filename = " & sBackupPrefix )
'WScript.Quit

strcmd = C_SharePointBin & "\stsadm.exe -o backup -url " & C_SiteURL & " -filename " & sBackupPrefix & "\companyweb.bak -backupmethod full -includeusersecurity"
wscript.echo strcmd 
objShell.Exec(strCmd)

WScript.Echo "Backup of site collection successful"
Set objshell = nothing

Answer : sbs 2008 script problem

You should have both of these lines

strcmd = "cmd /c """ & C_SharePointBin & "\stsadm.exe"" -o backup -url " & C_SiteURL & " -filename " & sBackupPrefix & "\companyweb.bak -backupmethod full -includeusersecurity"
strcmd = InputBox("Prompt", "Title", strcmd)

so that you build the comand, then the InputBox should display the command, so that you can copy and paste it into a DOS box.

Does the inputbox display at all?

Regards,

Rob.
Random Solutions  
 
programming4us programming4us