Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a script that is supposed to list all the installed programs on a machine. I want it to export it to a file for me.

I keep getting the error:

Supply Values for the following parameters: InputObject:

I'm missing something with my script below. I'm still new to powershell, and there's something wrong with the syntax I'm not getting.

How can I resolve this?


$loc = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall

$names = $loc |foreach-object {Get-ItemProperty $_.PsPath}

foreach ($name in $names)
{
Write-Host $name.Displayname
}
Export-Csv c:\products.txt
share|improve this question

1 Answer 1

Export-Csv wants an object to write into c:\products.txt.

From what you've posted, it's unclear what you want in there. What do you want c:\products.txt to contain?

share|improve this answer
    
I want it to display all the $names Sorry I'm a pretty bad programmer. I only am doing this at my job because I'm struggled through it before and written a few other scripts with the help of google. –  user227000 Jul 24 '14 at 12:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.