i'm brand new to powershell and trying to learn for my server scripting class. i have an assignment with the following requirements:
Use at least one function that accepts parameters.
Store and retrieve values using environment variables.
Include default values if no parameters or environment variables are provided.
Display the full ping output to the console.
DO NOT include the summary information displayed by the normal PING command.
Implement proper variable naming, looping, and conditional logic.```
here's what i have so far:
```powershell
<# TODO: documentation goes here dont forget moron
#>
function Ping-Host {
param(
[Parameter(Mandatory=$false)]
[string] $PING_HOST,
[Parameter(Mandatory=$false)]
[int] $PING_COUNT
)
if([string]::IsNullOrEmpty($PING_HOST)) {$PING_HOST = "8.8.8.8"}
if($PING_COUNT) {$PING_COUNT} else {$PING_COUNT = 2}
Write-Output "$PING_COUNT"
Write-Output "$PING_HOST"
Test-Connection -TargetName $PING_HOST -Count $PING_COUNT
}
Ping-Host```
right now im trying to figure out why the parameters i give it in the command line don't get used and instead always fallback to default values. **i'm not asking for someone to do it for me i just want some guidance, i really want to properly learn**