SQLScholar
Programmer
Hey all,
I have the below code.
and i am getting an error on this line
Set objFile = objFSO.OpenTextFile("C:\Audit\software_audit.txt", ForWriting)
objFile.Write StrNewFile
saying
"Invalid procedure call or argument".
Any ideas?
I cant work out what i am doing wrong?
Many thanks
Daniel
----------------------------------------
Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Dr. Seuss
Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
I have the below code.
Code:
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFileList = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='C:\audit\software'} Where " _
& "ResultClass = CIM_DataFile")
For Each objFile In colFileList
strName = objFile.FileName
strName = Replace(strName, "_", " ")
'Wscript.Echo strName
Set objFile = objFSO.OpenTextFile(objFile.Name, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
IF instr(strline,"DisplayName REG_SZ") then
StrNewFile = strLine & "," & strName & VBCR
end if
Loop
objFile.close
Next
Set objFile = objFSO.OpenTextFile("C:\Audit\software_audit.txt", ForWriting)
objFile.Write StrNewFile
objFile.Close
and i am getting an error on this line
Set objFile = objFSO.OpenTextFile("C:\Audit\software_audit.txt", ForWriting)
objFile.Write StrNewFile
saying
"Invalid procedure call or argument".
Any ideas?
I cant work out what i am doing wrong?
Many thanks
Daniel
----------------------------------------
Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Dr. Seuss
Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------