Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


List add and remove programs

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,54859
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> List add and remove programs
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2 3   next >   >>
Login
Message << Older Topic   Newer Topic >>
 List add and remove programs - 1/3/2008 6:52:36 AM   
  aburt

 

Posts: 104
Score: 0
Joined: 12/4/2006
Status: offline
I have a script that list all programs in the add and remove programs. 


Ok here is the problem. Our company is in the process of rolling out new computers. For each client who is receiving a new computer, Our techs write down a list of applications that are not part of our base image.

However, what Im trying to do is have the script list all applications that are not of the base image and  place in a text file. I used the script below and ran it on our base image to get the initial list of applications.   I need help editing what I have below to search the local machine's add and remove programs and list  the applications (that are NOT in our initial base image.txt file) in the text file that is created.

I am new to scripting and I dont know where to begin.  Your help would be GREATLY APPRECIATED.
 

      
 
 
Post #: 1
 
 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

(in reply to aburt)
 
 
Post #: 2
 
 RE: List add and remove programs - 1/3/2008 7:34:24 AM   
  aburt

 

Posts: 104
Score: 0
Joined: 12/4/2006
Status: offline
Absolutely correct

(in reply to ebgreen)
 
 
Post #: 3
 
 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

(in reply to aburt)
 
 
Post #: 4
 
 RE: List add and remove programs - 1/3/2008 7:55:48 AM   
  aburt

 

Posts: 104
Score: 0
Joined: 12/4/2006
Status: offline
EBGreen  

I really need some guidance on your suggestion.  Hopefully, you can drum up some energy to look at what I have so far. Pleeeeeeeeeeeeeassse.    My text file has application and version.  Im really looking for applications that are not part of my base image text file.  The list that gets created would be the applications that the users would need installed on his new machine.

(in reply to ebgreen)
 
 
Post #: 5
 
 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

(in reply to aburt)
 
 
Post #: 6
 
 RE: List add and remove programs - 1/3/2008 9:22:09 AM   
  aburt

 

Posts: 104
Score: 0
Joined: 12/4/2006
Status: offline
Please forgive me but Im an not clear on how to loop through the entries in the Add Remove

(in reply to ebgreen)
 
 
Post #: 7
 
 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)

(in reply to aburt)
 
 
Post #: 8
 
 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 >

(in reply to aburt)
 
 
Post #: 9
 
 RE: List add and remove programs - 1/4/2008 12:30:58 AM   
  aburt

 

Posts: 104
Score: 0
Joined: 12/4/2006
Status: offline
Hey Meg,

I thought I explained before why your script did not work for my particular use.  I am using this to deploy through sms so an html file will not work.  But I appreciate your effort. 

I really could use some help on the script I am working on .   If you can offer any advice on how to get my script to work I'd reallly appreciate it.  According to ebgreen I should get the base image text file into a read all


      


Also EBgreen mentioned that my script was not formatted.  For future reference how should I properly format.

(in reply to Meg)
 
 
Post #: 10
 
 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

(in reply to aburt)
 
 
Post #: 11
 
 RE: List add and remove programs - 1/4/2008 1:57:02 AM   
  aburt

 

Posts: 104
Score: 0
Joined: 12/4/2006
Status: offline
Hey guys,

I am trying to learn how to edit what I have. I learned from this sight if you have something that's is close to working don't abandon it .  I'm almost there.   Has anyone ever worked on something and know there close to resolving.   I think it makes more sense to work with what I have then to start from scratch trying  learn Megs script and then figure out how to get it work for my particular use.  I might as well just edit my own for my particular use.  Besides I will never learn how to get working in the script I have.  I would like to learn where I am going wrong. 

EBGreen,  as u probably are aware I am new scripting and trying to follow your first set of directions on using readall for the base image list.  R you willing to help me complete that.

I can format what I have if it will make things better, but Im just not sure what I need to do. 

(in reply to aburt)
 
 
Post #: 12
 
 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

(in reply to aburt)
 
 
Post #: 13
 
 RE: List add and remove programs - 1/4/2008 2:18:02 AM   
  aburt

 

Posts: 104
Score: 0
Joined: 12/4/2006
Status: offline
EBGreen

Thank you, Thank you ,Thank you 

Ok the initial base file was created from the script that I have.  Specifically, Function GetAddRemove(sComp) (pulls the applications)
the base file will always be the same.


      

Here is part of the output

INSTALLED SOFTWARE (300) - BT53348- 1/4/2008 10:14:48 AM
ADM Files For XP SP2 Ver: 1.0.0
Adobe Acrobat 7.0 Standard Ver: 7.0.9
Adobe Acrobat 7.0.9 Standard Ver: 7.0.9
Adobe Anchor Service CS3 Ver: 1.0
Adobe Asset Services CS3 Ver: 3
Adobe Bridge CS3 Ver: 2
Adobe Bridge Start Meeting Ver: 1.0
Adobe Camera Raw 4.0 Ver: 4.0
Adobe CMaps Ver: 1.0
Adobe Color - Photoshop Specific Ver: 1.0
Adobe Color Common Settings Ver: 1.0.1
Adobe Color Common Settings Ver: 1.0.1
Adobe Color EU Extra Settings Ver: 1.0
Adobe Color JA Extra Settings Ver: 1.0
Adobe Color NA Recommended Settings Ver: 1.0
Adobe Default Language CS3 Ver: 1.0

(in reply to ebgreen)
 
 
Post #: 14
 
 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

(in reply to aburt)
 
 
Post #: 15
 
 RE: List add and remove programs - 1/4/2008 4:35:14 AM   
  aburt

 

Posts: 104
Score: 0
Joined: 12/4/2006
Status: offline
EBGreen


I added the following to the script and I just get all apllications on the local machine in add and remove programs for the output. 


Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
strBaseAppList = oFSO.OpenTextFile("e:\Add Remove Programs\baseimage.txt").ReadAll()

For Each strItem in Split(GetAddRemove(scomp), vbCrLf)
  If InStr(strBaseAppList, strItem) <= 0 Then
      WScript.Echo "Machine XYZ is missing " & strItem
  End If
Next

Am I doing something wrong

(in reply to ebgreen)
 
 
Post #: 16
 
 RE: List add and remove programs - 1/4/2008 4:46:47 AM   
  ebgreen


Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
Does it say Machine XYZ in the output?

_____________________________

"... 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

(in reply to aburt)
 
 
Post #: 17
 
 RE: List add and remove programs - 1/4/2008 4:50:09 AM   
  aburt

 

Posts: 104
Score: 0
Joined: 12/4/2006
Status: offline
no none of output prints that line.

(in reply to ebgreen)
 
 
Post #: 18
 
 RE: List add and remove programs - 1/4/2008 4:59:16 AM   
  ebgreen


Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
Let's see what is really in those strings. Right before the loop, put this:

WScript.Echo strBaseAppList
WScript.Echo GetAddRemove(scomp)

_____________________________

"... 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

(in reply to aburt)
 
 
Post #: 19
 
 RE: List add and remove programs - 1/4/2008 5:48:04 AM   
  aburt

 

Posts: 104
Score: 0
Joined: 12/4/2006
Status: offline
The code you told me to add is between the lines of stars

when I run this I get a text file with all the applications on the local machine
output which list all applications in the base image text file and

and an error

E:\Scripts\addremove.vbs(49, 1) Microsoft VBScript runtime error: Variable is undefined: 'scomp'


      

(in reply to ebgreen)
 
 
Post #: 20
 
 
Page:   [1] 2 3   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.