in #vAgentConfiguration.Agent TempDir# I have 4 text files.
The content is a drive-letter.
Example 2 (another Server):
Example 3 (another Server):
Now I need a possibility to get this informations back to a new text file in this format:
for example 1:
for example 2:
for example 3:
Whats the best way to realize this?
Thanks for helping!
This one gets rid of the duplicate drive letters
Dim fso, folder, files, NewsFile,sFolder
Const ForReading = 1
Const ForAppending = 8
Drives = ""
sfolder = "C:\kworking\exchange" ' Change this to what every directory you use
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(sFolder)
Set files = folder.Files
row = 0
For each folderIdx In files
if right(sName,3)="txt" then
row = row + 1
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objfile = objFSO.opentextfile(sfolder + "\" + folderIdx.Name,forreading)
do until objfile.AtEndOfStream
filecontent = objfile.readline
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = filecontent
Set colMatches = objRegEx.Execute(drives)
If colMatches.Count = 1 Then
on error resume next
if err.number = 0 then
if row = 1 then
Drives = filecontent
Drives = Drives & "," & filecontent
'folderidx.delete 'Uncomment this line if you want the files deleted after they have been processed
Set objFile = objFSO.createTextFile(sfolder + "\ExchangeVolumes.ini")
Well im not sure what's the "BEST" way of doing it is and im sure that will start a pointless debate.
However if it was me i'd use VB
Doing a read line and grouping them then out putting the results in the desired format.
I guess the real question should be why do they need to be in C:,D:,E: format
I need this format for a exchange Backup Procedure and my last step is to get this information back in this format!
wbadmin start backup -backupTarget:F: -include:C:,D: -vssfull -quiet
Thanks for helping
It's not perfect as it includes the same drive letter if it occurs more than once.
Also have changed the output file name to give it an extension of .ini.
This was simply because while testing all the text files where in the same folder so the script double processes the ExchangeVolumes.txt file as it has the same extension as the other files .. So have a play ...
on error resume next
what should I say? GREAT WORK!