been trying to get this to output to a csv. Works fine in of itself, but can't figure out how to do it. I guess because I'm using write-host it never actually goes in the pipeline which gives me a null pipeline input error. I've tried playing aroung with a few other ways to no avail. Here is the "stock code" i'd like to manage to export into a csv:
$InstalledSoftware = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
foreach($obj in $InstalledSoftware)
{write-host $obj.GetValue('DisplayName') -NoNewline;
write-host " - " -NoNewline;
write-host $obj.GetValue('DisplayVersion')}
As I said, it seems like it the pipeline remains empty so adding | export-csv
doesn't work. I don't even need it to write output it on screen, although it's a nice plus, so for now I'll try to reformulate it with something other than write-host.