How do I record an Error in Excell


###### Start Posh Script ######## 

<# ==============================================================================================
Microsoft PowerShell Source File -- Created with SAPIEN Technologies PrimalScript 2011
NAME: ErrorView.ps1
AUTHOR: OldDog
DATE  : 5/18/2012
COMMENT: Ping does not return an Error
 Use Test-Connection instead
==============================================================================================
#>

If ($Error) {
               $ErrorView = "CategoryView"
                $y = $error | select Exception
                $e = $y -split (":")
                $x = $e[2]
                $ws1.Cells.Item($row, 3) = $x
                $ws1.rows.Item($row).Font.ColorIndex = "3"
                $row++
                $Error.Clear()
                $range = $ws1.usedRange
                [void]$range.entireColumn.Autofit()
                $ErrorView = $null
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s