Question
Please help me solve this. Powershell only & please show input and output. Question: The following function attempts to accept three mandatory parameters: input file,
Please help me solve this. Powershell only & please show input and output.
Question: The following function attempts to accept three mandatory parameters: input file, list of one or more hash algorithms, and output file that saves the hash values of the input file. Your task is to complete the function by writing the code needed to efficiently and effectively implement function in the specified block. You must implement some form of looping to access the elements in $hashalgirthm.
function Return-FileHash {
param (
[Parameter(Position=0,Mandatory=$true,ValueFromPipeline=$true)] [ValidateSet("SHA1","SHA256","SHA384","SHA512","MD5")]
[STRING[]]
# the array list that contains one or more hash algorithm input for Get-FileHash cmdlet
$hashAlgorithm,
[Parameter(Position=1, Mandatory=$true,ValueFromPipeline=$true)]
# the document or executable input/InputStream for Get-FileHash cmdlet
$filepath,
[Parameter(Position=2,Mandatory=$true,ValueFromPipeline=$true)]
# the output file that contains the hash values of $filepath
$hashOutput
)
Return-FileHash
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started