On the attached script, do you know what is the error handling function?

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
icon
Related questions
Question

Book reference: Windows PowerShell Step by Step 3rd Edition - Ed Wilson
Chapter 19

10. On the attached script, do you know what is the error handling function?

Param(
[Parameter (Mandatory=$true)]
[string]$drive,
[string] $computerName
#end param
$env:computerName
Function Check-AllowedValue ($drive,
{
$drives
Get-WmiObject -class Win32_Volume -computername
Where-Object { $ _ . DriveLetter } I
ForEach-–Object { $drives += @{ $ .DriveLetter
$drives.contains ($drive)
}
$computerName)
= $null
$computerName |
$ . DriveLetter } }
#end function Check-AllowedValue
Function Get-DiskInformation($computerName,$drive)
{
Get-WmiObject -class Win32_volume -computername
}
$computername -filter "DriveLetter
'$drive'"
#end
function Get-BiosName
***
Entry Point To Script
***
if(Check-AllowedValue -drive $drive -computername $computerName)
{
Get-DiskInformation -computername $computerName -drive $drive
}
else
{
Write-Host -foregroundcolor blue "$drive is not
an allowed value:"
}
Transcribed Image Text:Param( [Parameter (Mandatory=$true)] [string]$drive, [string] $computerName #end param $env:computerName Function Check-AllowedValue ($drive, { $drives Get-WmiObject -class Win32_Volume -computername Where-Object { $ _ . DriveLetter } I ForEach-–Object { $drives += @{ $ .DriveLetter $drives.contains ($drive) } $computerName) = $null $computerName | $ . DriveLetter } } #end function Check-AllowedValue Function Get-DiskInformation($computerName,$drive) { Get-WmiObject -class Win32_volume -computername } $computername -filter "DriveLetter '$drive'" #end function Get-BiosName *** Entry Point To Script *** if(Check-AllowedValue -drive $drive -computername $computerName) { Get-DiskInformation -computername $computerName -drive $drive } else { Write-Host -foregroundcolor blue "$drive is not an allowed value:" }
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT