PoshCode Archive  Artifact [4043e271dd]

Artifact 4043e271ddf2cd49cf6b13246a69f8e8a6aecf2754657f37e83143777d434a73:

  • File Get-WarningsAndErrors.ps1 — part of check-in [858f5724b4] at 2018-06-10 13:06:18 on branch trunk — From Windows PowerShell Cookbook (O’Reilly) by Lee Holmes (user: Lee Holmes size: 912)

# encoding: ascii
# api: powershell
# title: Get-WarningsAndErrors.ps
# description: From Windows PowerShell Cookbook (O’Reilly) by Lee Holmes
# version: 0.1
# type: function
# author: Lee Holmes
# license: CC0
# x-poshcode-id: 2168
# x-archived: 2016-03-18T21:20:12
# x-published: 2011-09-09T21:41:00
#
#
##############################################################################
##
## Get-WarningsAndErrors
##
## From Windows PowerShell Cookbook (O'Reilly)
## by Lee Holmes (http://www.leeholmes.com/guide)
##
##############################################################################

<#

.SYNOPSIS

Demonstrates the functionality of the Write-Warning, Write-Error, and throw
statements

#>

Set-StrictMode -Version Latest

Write-Warning "Warning: About to generate an error"
Write-Error "Error: You are running this script"
throw "Could not complete operation."