I'm trying to use param within Powershell 5 My script is as following:
param(
[parameter(mandatory=$true)]
[string]$IP,
[parameter(mandatory=$true)]
[string]$Time
)
Write-Host $IP
Write-Host $Time
Suppose the script is named test.ps1, I tried running it in 2 ways:
.\test.ps1 -IP 10.10.10.10 -Time 10:10
.\test.ps1 -IP "10.10.10.10" -Time "10:10"
None of these work. Instead, it prompts me to enter a value to IP. The error is as following:
cmdlet test.ps1 at command pipeline position 1
Supply values for the following parameters:
IP:
Obviously this little script is just a phase in integrating a piece of code into a bigger script system. Help would be appreciated, after hours of searching I don't see what I've done wrong.