Const ForReading = 1
Dim arrTapes()
Redim arrTapes(1)
strPrevTapeNumber = "xxxx"
Dim objDictionary
Set objDictionary = CreateObject("Scripting.Dictionary")
'Reading Arguments from the commandline
Set args = WScript.Arguments
argTapesExportFile = args.Item(0)
argPoolName = args.Item(1)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(argTapesExportFile, ForReading)
Do While objTextFile.AtEndOfStream <> True
strLine = objtextFile.ReadLine
If inStr(strLine, argPoolName) Then
strTapeNumber = Mid(strLine,InStr(strLine,argPoolName) - 7,7)
if not inArray(arrTapes,strTapeNumber) then
redim preserve arrTapes(ubound(arrTapes)+1)
arrTapes(ubound(arrTapes)) = strTapeNumber
wscript.echo arrTapes(ubound(arrTapes))
end if
End If
strPrevTapeNumber = strTapeNumber
Loop
function inArray(a,value)
for each v in a
if v = value then
inarray = true
exit function
end if
next
end function
RAR command line with real world example
Every week I make an ASR backup of my Windows 2003 R2 servers, some of them are physically located at another site. Due to that fact I had to think of a secure way to get my data over the WAN to my office. Just plain copying is not an option because we all know if one bit falls over my complete ASR backup is rubbish. And I would have wasted precious bandwidth. A solution I could come up with was to use plain old WinRar, I found out that there was a command line version as well. But the help that comes with that version is kinda cryptic. Below is my command line that I came up with. rar a d:\asr-bu\done\asr_server.rar -ri1 -mt2 -ag[yyyy-mm-dd] -rv10 -v51200 -m5 d:\asr-bu\*.bkf I will explain it in full detail: rar a d:\asr-bu\done\asr_server.rar -ri1 -mt2 -ag[yyyy-mm-dd] -rv10 -v51200 -m5 d:\asr-bu\*.bkf a = add files to archive, that really speaks for itself I think. we are going to add files to an archive. rar a d:\asr-bu\done\asr_server.rar...
Comments