I have a powershell function that takes a parameter like this:
function whatever {
param (
[parameter(Mandatory=$true)]
[Net.IPAddress]
$ip1,
[parameter(Mandatory=$true)]
[Net.IPAddress]
$ip2
)
}
I am getting an error calling
whatever("1.1.1.1","2.2.2.2")
The error I get is
Cannot process argument transformation on parameter ‘ip1’. Cannot convert the “System.Object[]” value of type “System.Object[]” to type “System.Net.IPAdd
ress”.
I have also tried setting a var to be something like
$ipaddr=[Net.IPAddress]("1.1.1.1")
but it yields the same error.
Any help would be great
You are passing an array of string to your function arguments are passed using spaces in powershell
whatever "1.1.1.1" "2.2.2.2"