Forum Discussion

theredmoose's avatar
theredmoose
Copper Contributor
Oct 10, 2019

Multiple command output to file

 

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"

Resources