I'm working on a script that will run as a scheduled task under a local admin account. The heart of the script is as follows:
'Calculate date time
dtm = Now
ymd = (Year(dtm)*10000) + (Month(dtm)*100) + Day(dtm)
hms = (Hour(dtm)*10000) + (Minute(dtm)*100) + Second(dtm)
dString = ymd & "_" & hms
Set Wso = CreateObject("WScript.Shell")
'Write random string to text file for reference by incremental script
Const ForWriting = 2
Set objFile = Fso.OpenTextFile("e:\backups\dString.txt", ForWriti开发者_开发技巧ng, True)
objFile.WriteLine(dString)
objFile.Close
'Append random string to make full backup name unique'
'Execute full backup creation'
'PROBLEM: Below line will only execute under my domain account
Wso.Run("trueimagecmd /create /filename:""e:\backups\autoBackup_" & dString &"_.tib"" /compression:5 /incremental /partition:""C""")
The above snippet will run fine under my domain account, but will error on the line indicated above with the following:
The system cannot find the file specified
Code: 80070002
Source (null)
This error will not occur when I run it under my account. I'm not familiar enough with the permissions required to run an instance of "Wscript.Shell". Any insight is appreciated.
UPDATE:
trueImagecmd is a command line version of Acronis recovery software. I'm using this script as a way of automating the process for deployment. The command is fine and I can run this script as myself, when running under the local admin account, however, the script executes up to the point indicated, the run command is throwing the error.
UPDATE 2:
Looks like including the full path fixed the problem. Thanks all for your suggestions.
Have you tried calling trueimagecmd with the full path to the executable? For instance C:\progra~1\trueimage\trueimagecmd.exe
Make sure you have drive E in the other machine from where it generates error. Try using c:\backups\autoBackup_" & dString &".tib" instead of e:\backups\autoBackup" & dString &"_.tib"
精彩评论