|
Guy recommends :
Find out which of your VMs are a waste of space and which VMs need more resources.
|
PowerShell Win32_ProductPowerShell Script to Display Installed ProgramsLet us ask PowerShell the question, which programs are installed on this machine? I'll bet you will find at least one program that has muscled its way into your computer without your approval. Topics for PowerShell's Win32_Product
♣ IntroductionI would like to remind you that most PowerShell scripts merely mimic tasks that you can perform manually. Another prime reason for scripting is to automate boring tasks. In the case of this week's script it would be tedious to wade through all the programs in the C: \Programs Files. There again, other files maybe stored in the C: \Programs Files (x86) folder, while yet more programs maybe stored who knows where. For this particular task we can also use WMIC to display a list of installed programs. Mission: To List Your Installed ProgramsOur real-life task is to identify rogue programs that have persuaded you (or another user) to install them. To achieve our mission we are going to use PowerShell. Specifically, employ a WMI class called Win32_Product. Barking Eddie's Non-PowerShell SolutionHere is Eddie's short but sweet WMI method for listing all programs installed on a computer. Go to the command prompt, and type: # Note from the command-line type: Note: You could type the above command in PowerShell, however I wanted to emphasise that WMIC an operating system command. PowerShell Win32_Product Equivalent to WMIC's List Installed ProgramsIn the following example we build upon the above WMI idea by researching Get-WmiObject's classes. The most useful of which is Win32_Product. Eddie's tried and trusted method of using WMIC is good. Yet PowerShell can not only match this command-line program, but also it has features such as sort-Object and -groupBy that Eddie cannot reproduce in WMIC. # PowerShell Win32_Product
script to list installed programs Optional parameter -groupBy # Win32_Product with -groupBy
Note: While it does not change the output, you
could explicitly define the WMI Class thus:
Guy
Recommends: WMI Monitor and It's Free!
|
||||
Custom Search
|
Guy Recommends: WMI Monitor and It's Free!
|
|
Home Copyright © 1999-2012 Computer Performance LTD All rights reserved Please report a broken link, or an error. | |