Re: Multiple append in text files

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I think this will work for you. You may want to consider settings
those client scripts just to write back to a central DB. That would
save a lot of trouble in the long run once you get it setup properly.
Also may want to add some error checking


All is delimited with "::"
txtFiles = place where the -hw and -sw files would be located
sInventoryPath = place to put the -inv files for the pcs


Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

sInventoryPath = ".\inv\"

Set oFSO = CreateObject("Scripting.FileSystemObject")
set oFolder = oFSO.GetFolder(".\txtFiles")


For Each File in oFolder.Files
sComputer = ""
sTemp = ""

sComputer = Left(File.Name,(Len(File.Name)-Len("-hw.txt")))

wscript.echo sComputer

Set oTempFile = oFSO.OpenTextFile(File.Path,ForReading)
sTempReadAll = Replace(oTempFile.ReadAll,vbcrlf,"::")
oTempFile.Close

Set oInventory = oFSO.OpenTextFile(sInventoryPath & sComputer &
"-inv.txt",ForWriting,1)
oInventory.writeline sComputer & "::" & sTempReadAll
oInventory.Close

Next


fredriklarsso@xxxxxxxxx wrote:
Hi,

I have a script making an inventory in excel from hardwareinfo in about
150 text files
http://groups.google.com/group/microsoft.public.scripting.vbscript/browse_thread/thread/94d791ee70a717b1/0f2635c12d6347dd#0f2635c12d6347dd

At every logon there is one hardware file and one software file created
for every PC. There is no problem making some adjustment and make a new
script to get the software inventory to an excel file...but

the text files is named:
computername-hw.txt and computername-sw.txt and it's about 150 files
each.

the format in the files is the same:

pcname~user~department~.... in hw
antivirus~office version~Service packs~... in sw and so on

is it possible to get the info in the software files into the hardware
files and make the info from one computer on one line

computer1-hw.txt
computer1~john doe~accounting~...

computer1-sw.txt
symantec 10~microsoft office 2003 pro~1~...

computer2-hw.txt
computer2~anita stone~HR~...

computer2-sw.txt
Symantec 10~Microsoft office XP~4...

to
computer1-inv.txt
computer1~john doe~accounting~...symantec 10~microsoft office 2003
pro~1~...

computer2-inv.txt
computer2~anita stone~HR~...Symantec 10~Microsoft office XP~4...

so when i copy *-inv.txt inventory.txt i will have one file like this
inventory.txt
computer1~john doe~accounting~...symantec 10~microsoft office 2003
pro~1~...
computer2~anita stone~HR~...Symantec 10~Microsoft office XP~4...

Or can i get the info from the excel file software.xls into
hardware.xls? The only thing that is the same in the two excel files is
the serial number of the computers

.



Relevant Pages

  • Re: Multiple append in text files
    ... When i run the script i get a new txt file for every computername* in ... At every logon there is one hardware file and one software file created ... Or can i get the info from the excel file software.xls into ...
    (microsoft.public.scripting.vbscript)
  • RE: AD-Users to contacts
    ... I've written a script that takes in input the data from a "well formatted" ... excel file that show the result of each creation. ... - Uppercase letters will be substituted whit lowercase letters ... users in formation from the old directory, the first part of the job). ...
    (microsoft.public.windows.server.scripting)
  • Re: AD-Users to contacts
    ... Hi SubnetJO! ... > I've written a script that takes in input the data from a "well formatted" ... > excel file that show the result of each creation. ... after you ave filled the input file with data (dumping ...
    (microsoft.public.windows.server.scripting)
  • Re: [opensuse] speaking of cloning....
    ... XML based script which largely goes through the options described by ... other posters in cloning a machine. ... hardware I can quickly get going again. ... For hardware flexibility, autoyast would be best, probably. ...
    (SuSE)
  • kernel drivers database (hardware, config, file) and "autoconfiguration"
    ... I've build a python script to ... build a hardware database fomr kernel sources, ... CONFIG_ you should check. ...
    (Linux-Kernel)