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!!
'', '\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"
[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
https://devblogs.microsoft.com/scripting/use-powershell-to-quickly-find-installed-software/