PowerShell Output to Log File  


  1. Posts : 190
    Windows 10, 22H2 10.0.19045
       #1

    PowerShell Output to Log File


    I know that "Get-Hotfix" in PowerShell will get me a nice output of my installed updates.
    PowerShell Output to Log File-get-hotfix.png

    Can someone point me in the right direction of how to get a log (for lack of a better term) file on my Desktop of this output.

    Thanks!
      My Computer


  2. Posts : 14,889
    Windows 10 Home x64 Version 22H2 Build 19045.2965
       #2

    There are lots of methods. The simplest is the same as it is in the cmd prompt
    Code:
    >
    so you use [with your own folder path instead of mine]
    Code:
    get-hotfix >D:\Desktop\Get-HotFix.txt


    You might also wish to study
    Export-Csv - SS64 and, for the -Append switch explanation, Export-Csv - MSDocs
    Format-Table - SS64
    Out-GridView - SS64 and PowerShell - using Out-GridView tables - Windows Questions
    examples of Get-ChildItem, Add-Content [log file] - Stack Overflow
    Out-File - SS64
    Tee-Object - SS64
    Write-Host - MSDocs
    Write-Output - MSDocs
    Export PowerShell output to Excel (GSD) - SSX

    Denis
      My Computer


  3. Posts : 190
    Windows 10, 22H2 10.0.19045
    Thread Starter
       #3

    @Try3 Many thanks, not only a solution, but information to digest with my morning coffee. Once you move beyond the basic Windows package, it's a fascinating OS.

    Marking as Solved.
      My Computer


  4. Posts : 14,889
    Windows 10 Home x64 Version 22H2 Build 19045.2965
       #4

    Homer,

    It would have to be a very large pot of coffee.

    I find that I tend to use either that simplest method [the > redirection] or csv outputs. So perhaps you could just study csv for now and keep the other links for reference.

    All the best,
    Denis
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 09:34.
Find Us




Windows 10 Forums