Login | |
|
 |
RE: List add and remove programs - 1/3/2008 7:07:00 AM
|
|
 |
|
| |
ebgreen
Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
|
I'll be honest with you. I'm too lazy to read your script. It sounds like you have the ability to determine the contents of Add/Remove already. You have a text file already of the base apps and you just want to know if each app on the machine is in that text file or not. Is that a fair summation?
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: List add and remove programs - 1/3/2008 7:38:01 AM
|
|
 |
|
| |
ebgreen
Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
|
In that case, simply read all the contents of the textfile into a string as one big slurp by using the .ReadAll() method of the File object for the text file. Next, as you go through the list of Add/Remove items on the machine that you are checking, use InStr() to see if the software named in Add/Remove exists in the string.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: List add and remove programs - 1/3/2008 8:10:08 AM
|
|
 |
|
| |
ebgreen
Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
|
Maybe if the code was formatted I could drum up the energy. I realize that there is a good chance that the lack of formatting is the result of the board mangling it but either way, I'm just too lazy today. Instead I will give some generic and pseudocode examples. First if the text file with the base inmage apps was named c:\foo.txt, then this is how you would get the string to compare against: Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject") strBaseAppList = oFSO.OpenTextFile("C:\foo.txt").ReadAll() Now, somewhere you should be looping through all of the entries in Add\remove. Here is some pseudo/real code on how to do the comparison: For Each oAddRemoveItem In (Whatever list you are looping through) strInstalledItem = [BUILD THE STRING THAT REPRESENTS THE INSTALLED SOFTWARE THE EXACT SAME WAY THAT YOU DID WHEN YOU MADE THE BASE LIST] If InStr(strBaseAppList, strInstalledItem) <=0 Then 'This is some software that is on this machine that is not in the base image [WRITE strInstalledItem to a textfile for this machine here] End If Next
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: List add and remove programs - 1/3/2008 11:11:49 AM
|
|
 |
|
| |
DiGiTAL.SkReAM
Posts: 1097
Score: 6
Joined: 9/6/2005
From: Florida, USA
Status: offline
|
Please forgive ebgreen. We need to be mindful that senior citizens just don't have the energy that we of the younger generation(s) do. But I bet he was Da MAN back during the Great Depression! How was your AARP meeting, ebgreen?  
_____________________________
"There's the one man who learns by reading, the two men that learn by watching, and the rest of us have to pee on the electric fence for ourselves." - Roy Rogers "Would you like to touch my monkey?" - Dieter (Mike Meyers)
|
|
| |
|
|
|
 |
RE: List add and remove programs - 1/3/2008 1:27:05 PM
|
|
 |
|
| |
Meg
Posts: 123
Score: 2
Joined: 7/13/2006
From: Australia
Status: offline
|
Hi aburt, You still working on that AddRemove script? There is an example in my script which you rejected as unsuitable earlier. http://www.visualbasicscript.com/m_53955/mpage_1/key_/tm.htm#53955 It gets the complete list of items in AddRemove as a file which is then split into an array Each item in the array is checked against the base reference file. If the item is not in the base reference file or is in the base reference file and is not marked as hide it is outputed to a display page which can then be printed.
< Message edited by Meg -- 1/3/2008 2:56:39 PM >
|
|
| |
|
|
|
 |
RE: List add and remove programs - 1/4/2008 1:10:36 AM
|
|
 |
|
| |
ebgreen
Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
|
So it appears that Meg has provided a solution that does what you want except that it is an HTML. Have you ever heard the saying that there is no original art any more? Well that is often true for scripting as well. The fact that Meg's solution is in an HTML is purely cosmetic. The code that does the work is still vbscript. Go through what she provided, understand it, then pull out the pieces that do what you want and leave the HTML part behind like the carcass of a Christmas turkey.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: List add and remove programs - 1/4/2008 2:08:22 AM
|
|
 |
|
| |
ebgreen
Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
|
You are right that you are usually better off figuring out what you already have. So, how did the text file that lists the base image apps get made? What code generated it?
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: List add and remove programs - 1/4/2008 2:45:05 AM
|
|
 |
|
| |
ebgreen
Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
|
Ok, thanks for cleaning up the formatting some. Let's say for instance that you have a text file with the base image apps c:\foo.txt. Then as we previously discussed, you would do this to get it's contents: Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject") strBaseAppList = oFSO.OpenTextFile("C:\foo.txt").ReadAll() Now let's say you wanted to compare machine XYZ to this list. Here is what I would do: For Each strItem in Split(GetAddRemove("XYZ"), vbCrLf) If InStr(strBaseAppList, strItem) <= 0 Then WScript.Echo "Machine XYZ is missing " & strItem End If Next Granted you will probably want to change it to output to a more permanent storage, but this should get you started. @Digital: You would be amused to hear this story. I was at a work Christmas party and I saw someone that I don't see very often. She says to me "I thought that your hair was darker". My reply "You're right. Every time I get it cut it seems to be a little more grey".
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|