ealy
(Mealy58)
1
Description
Need to know what’s installed on a system. powershell to the rescue.
Source Code
Get-WmiObject -Class Win32_product | Select Name,Vendor,Caption | Out-file C:\Programs.txt
Hi! I’d like to offer some tips for improvement. 1.) This it’s only useful for finding information on a local system. I could just as well visit the control panel tho get this info in that case. Including the -ComputerName $RemotePCHere option would make it more useful as you could then gather installed apps from a specified remote computer. You could even use Read-Host to prompt for a computer name that it enters into the -ComputerName option for you. 2.) Alternatively, maybe you want it to run locally, but then you need the info for use in another script. Pre-pend the line with something like "$MyVar = " and now you have the gathered info in a table and you can perform operations on the data. 3.) To burn up all the above ideas though, using WMI to get installed application information is actually a bad idea for a number of reasons, namely because doing so can trigger repair installs of applications (see Use PowerShell to Quickly Find Installed Software - Scripting Blog [archived]). It’s better (although a bit more complicated) to query the registry instead. Also, saving an output file to the root of C: can often fail due to rights issues. I suggest saving to the desktop instead ($Env:USERPROFILE\Desktop\Outfile.txt). I won’t spoil the fun by rewriting your code to illustrate these, but thought I’d share some input and recommendations.
ericfalch
(ericfalch)
3
Get following message: “Get-WmiObject” is not recognized as as an internal or external command. Any help?
jitensh
(JitenSh)
4
You you avoid wmi to find softwares installed on computer it takes long and reconfigures all the software’s you will see in events of application.
ealy
(Mealy58)
5
What version of shell are you running ericfalch ?
it is a PowerShell script, and working for me . thanks.