Need Help with example in the book

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
}
PROCESS {
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?