Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Combine cmdlet output into csv file

$
0
0

Hi there!

I am trying to combine output from cmdlets into one csv file.

I want to take the following as an example:

-  gwmi Win32_OperatingSystem -ComputerName $Computers |Select-Object Version

-  Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select DisplayName, DisplayVersion | where { $_.DisplayName -like"*Citrix*" }


Actually, my script looks like this :

$Computers = Get-Content .\comp.txt

foreach ( $name in $Computers ) {
    write-Host "Testing Network Connection with $name" -ForegroundColor Green
    if ( Test-Connection $name -Count 1 -Quiet ) {
    write-Host "Getting software information." -ForegroundColor Magenta -BackgroundColor White
        Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select DisplayName, DisplayVersion | where { $_.DisplayName -like"*Citrix*" } 
    }else {
        write-Host " $name is not found or not reachable." -ForegroundColor white -BackgroundColor Red
        }
    }

Any help would be appriciated :o)

Thank you




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>