I am having an issue with exporting results to a txt in Powershell. I have 2 commands I need to run and when they are done, I am hoping to get something like this:
Name Version
---- -------
Mitel Connect 214.100.1252.0
Cylance Unified Agent 2.4.1070.1
Instead of this:
Name Version
---- -------
Mitel Connect 214.100.1252.0
Name Version
---- -------
Cylance Unified Agent 2.4.1070.1
Here is the code:
get-package 'Microsoft Edge','Mitel Connect', '*7-Zip*','*Cylance*','*Office Profession*','*Dameware*','Cisco AnyConnect Secure Mobility Client' | select name,version | Out-File "C:\temp\export.txt" -Append
Get-WmiObject -Class Win32_Product | where Name -eq "Manageengine AssetExplorer Agent" | select Name, Version | Out-File "C:\temp\export.txt" -Append
I have tried piping the code, google and nothing works,
Does anyone have any idea who to get the output?
Get-CimInstance) superseded the WMI cmdlets (e.g.,Get-WmiObject) in PowerShell v3 (released in September 2012). Therefore, the WMI cmdlets should be avoided, not least because PowerShell (Core) v6+, where all future effort will go, doesn't even have them anymore. Note that WMI still underlies the CIM cmdlets, however. For more information, see this answer.