That actually gave me output in my text file. But with scripting. There must be some law that says nothing you do is going to be easy.
The output gives me all 301 applications whereas my orginal list only had 201 applications.
Here where it list 201 apps
************************************* WScript.Echo MisApp Function MisApp Dim arrApp() intSize = 0 For Each strItem In Split(GetAddRemove(sComp), vbCrLf) If InStr(strBaseAppList, strItem) <= 0 Then ReDim Preserve arrApp(intSize) arrApp(intSize) = strItem intSize = intSize + 1 End If Next For i = 0 to Ubound(arrApp) a = a + 1 Applic = arrApp(i)
'******************************* When I run this script I get a list of all applications missing from baseimage.txt
WScript.Echo "Machine vXYZ is missing " & a & " " & Applic Next
End Function
***********************************************
However if I run this it list 301 apps basically all application on the local system
Function MisApp Dim arrApp() intSize = 0 For Each strItem In Split(GetAddRemove(sComp), vbCrLf) If InStr(strBaseAppList, strItem) <= 0 Then ReDim Preserve arrApp(intSize) arrApp(intSize) = strItem intSize = intSize + 1 End If Next For i = 0 to Ubound(arrApp) a = a + 1 Applic = arrApp(i)
'******************************* When I run this script I get a list of all applications missing from baseimage.txt
'WriteFile "Machine vXYZ is missing " & a & " " & Applic, sFileName Next
Ok I think I get it. do you have any idea why the output is giving me all applications in the text file instead of just the ones not listed in the base image?
with detailed description about its usage. It does everything you need to determine and log the non-standard software on a computer. You ignored it completely. (Other than Meg, I don't mind such behaviour; I can understand that "starting afresh" isn't attractive to a person having to deliver a script ASAP.)
I told you many times that your script is mess. You acknowledged that but didn't do anything about it.
I answered more than one very basic question of yours; even adding demo scripts to show what is plainly written in the Docs.
Your vague statements about what you did and what you got make it very hard to diagnose your problem(s). E.g.: It's just not possible that code like
.... WScript.Echo ... ....
will output "all the lines of the (Apps missing from baseimage.txt)" AND code solely changed to
.... WriteFile ... ....
(provided the IO mode was set to ForAppending in that function) will give "all 301 applications whereas my orginal list only had 201 applications". You changed something else in between - an how should I know about that?
Nevertheless, I stepped thru a slightly modified version of the code you posted in
loads the file. So strBaseAppList is "" in MisApp(). Must I add: Nothing can be found in an empty string? Must I add: The "WScript.Echo" version of script couldn't have found anything in an empty string either?
So move
Dim strBaseAppList Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject") strBaseAppList = oFSO.OpenTextFile("E:\NEW DIR$\Scripts\Add Remove Programs\baseimage.txt").ReadAll()
before the call to MisApp() or - much better - rework the structure/logic/layout of your script in a way that makes it decent.