Need Help with example in the book

Welcome Forums General PowerShell Q&A Need Help with example in the book

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years ago.

  • Author
  • #5711

    Points: 0
    Rank: Member

    by jmp8600 at 2013-03-21 18:42:12

    Hello There,

    in the book Learn Windows PowerShell In the month of lunches. on Page 250. Don showed us example to capture machine names and exception in two different files.

    below is the example

    function Get-Stuff {
    BEGIN {
    del c:\retry.txt -ea SilentlyContinue
    del c:\errors.txt -ea SilentlyContinue
    Try {
    Get-WmiObject Win32_BIOS -comp $_ -ea Stop -ev WmiError
    } Catch {
    $_ | Out-File c:\retry.txt -append
    $WmiError | Out-File c:\errors.txt -append
    'Server-R2','Notonline','Localhost' | Get-Stuff

    by DonJ at 2013-03-23 09:28:17

    Welcome ;). As a note, you can use the CODE button here to keep your code formatted – makes it easier to read.

    It doesn't look like your post got completed – was there a question?

The topic ‘Need Help with example in the book’ is closed to new replies.