Multiple command output to file

Visitor

 

I am trying to run a few commands and then output my results to a file. When I run this script below it takes the MyOutput results as text instead of executing them.  What am I doing wrong?

 

$MyOutput = {
Get-ChildItem -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Dell\ -Recurse

"================";

Get-ChildItem Env:ComputerName
}

$MyOutput | Out-File -FilePath .\"DellRegValues- $env:computername.txt"

1 Reply