The powershell script below displays the application programs installed on each computer. It displays the UninstallString and the name of each application installed. I would like to redirect the results to a text file. I am having difficult time getting the script to redirect the results to a text file.
$Computers = Get-Content .\computers\computers.txt
$RegistryPath = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\',
'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'
foreach ($Computer in $Computers) {
$Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$Computer)
foreach ($RegPath in $RegistryPath) {
($Registry.OpenSubKey($RegPath)) | foreach {
$_.GetSubKeyNames() | ForEach-Object {
$ApplicationName = ($Registry.OpenSubKey("$RegPath$_")).GetValue('DisplayName')
$UninstallString = ($Registry.OpenSubKey("$RegPath$_")).GetValue('UninstallString')
if ([bool]$ApplicationName) {
New-Object -TypeName PSCustomObject -Property @{
'ComputerName' = $Computer
'UninstallString' = $UninstallString
'Application' = $ApplicationName
}
}
}
}
}
}