WUSA.exe Pass Errors to Powershell

Welcome Forums General PowerShell Q&A WUSA.exe Pass Errors to Powershell

This topic contains 2 replies, has 3 voices, and was last updated by

 
Participant
1 year, 3 months ago.

  • Author
    Posts
  • #83518

    Participant
    Points: 0
    Rank: Member

    All,

    I have been successful at getting wusa.exe to run and create its' own error log. How can I get it to pass any errors to Powershell so they can be written into the scripts logfile?

    wusa $item /quiet /norestart | Out-Null
    "$(Get-TimeStamp) | SUCCESS | Installed $item" | Out-File -FilePath $logpath -Append -Encoding ASCII
  • #83545

    Participant
    Points: 711
    Helping Hand
    Rank: Major Contributor

    Joseph,

    with

    wusa /?

    you can get the possible command line arguments wusa is able to process. I would assume they didn't design it to pass errors to the shell in another way than writing a log file. But because you can specify the log file wusa should use you could get the content of that log file and include it in whatever you like. 😉

    BTW: In your example you actually throw away everything wusa could possibly output with "| Out-Null"

  • #83762

    Participant
    Points: 101
    Helping Hand
    Rank: Participant

    Check out the The FREE 2017 #PSBlogWeek eBook here http://www.adamtheautomator.com/free-2017-psblogweek-ebook/

    Looks like its got a chapter on exactly what your looking for. "Logging and Error Handling Best Practices for Automating Windows Update Installs"

The topic ‘WUSA.exe Pass Errors to Powershell’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort