Avatar of Bill Purvis
Bill Purvis
 asked on

Installed Software

Hello Experts!!


I need a script that I can input the name of a piece of software say... "firefox" and the script search through my Active Directory computers and write the results to a file.

I do have a mixed environment of Windows and Linux computers so this would be for the Windows computers.


And I would like a second script that I can do the same as above AND put the OU name in to.  


I know there are tools that I can use to do this but I need these two scripts.


Thanks!!

Active DirectoryVB ScriptPowershell

Avatar of undefined
Last Comment
RobSampson

8/22/2022 - Mon
Andrew Porter

Bill Purvis

ASKER
Thank you Andrew Porter but this is not what I was hoping for.
Bill Purvis

ASKER
I have this PowerShell provided by oBdA that works on the server you are logged on to and gives ALL software but I need it to allow me to select the software I want, i.e. firefox, then search for it on all the computers in my AD, skipping the Linux ones.  
I would also like to be able to select the OU to run on and provide the same results.

Please help:
'', '\Wow6432Node' | ForEach-Object {    Get-ItemProperty -Path "HKLM:\Software$($_)\Microsoft\Windows\CurrentVersion\Uninstall\*" |     Where-Object {$_.DisplayName -and ($_.SystemComponent -ne 1) -and ($_.UninstallString)} |    Select-Object -Property DisplayName, DisplayVersion, Publisher, InstallDate, @{n='Architecture'; e={If ($_.PSParentPath -like '*\Wow6432Node\*') {'32bit'} Else {'64bit'}}} } | Sort-Object -Property Publisher, DisplayName |    Format-Table -AutoSize | Out-String | Out-File "C:\Users\rgtur\Desktop\Common Applications\Software Inventory.txt" 

Open in new window

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
RobSampson

Hi Bill, do you have SCCM / MECM to manage your workstations?  If so, you could utilise the SMS_InstalledSoftware WMI class.  Otherwise, using the Win32_Product class can be slow.
It can also be done via remote registry, similar to oBdA's code
https://bobcares.com/blog/powershell-list-installed-software/
For a single machine using the SMS_InstalledSoftware class, here's what I use
[CmdletBinding()]
Param(
  [Parameter(Mandatory=$False)]
    [string]$ComputerName,
    [string]$AppName
)
If (!$ComputerName) {
    $ComputerName = Read-Host -Prompt "Computername (type localhost or . for the local computer)"
}
If (!$AppName) {
    $AppName = Read-Host -Prompt "Application Name (partial match - enter * for all)"
}
If ($AppName -eq '*') {$AppName = ''}
Get-WmiObject -ComputerName $ComputerName -Namespace 'root\cimv2\sms' -Class SMS_InstalledSoftware | Where {$_.ARPDisplayName -like "*$AppName*"} | Select ARPDisplayName, ProductName, ProductVersion, InstallDate, SoftwareCode, UninstallString

Open in new window


Copy that code into the PowerShell ISE, and hit F5 to run it.

Rob.
Bill Purvis

ASKER
Hi Rob,
This is good *and slow like you said* but I have over 2,000 boxes to search through.  Any chance you can edit it for that?

Thanks
ASKER CERTIFIED SOLUTION
RobSampson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Bill Purvis

ASKER
THIS IS GREAT ROB!!  Thank you so much!!!!!!!!!!!!!!!!!!
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
RobSampson

No problem. Glad it's useful for you.

Rob.