I'm running a powershell script that has a mandatory variable from within another powershell script.
The script starts with:
function functionName([Parameter(Mandatory=$true)] [string] $deployVM
So when running this script on it's own I get prompted for the $deployVM parameter.
When I run this script from within another script and can't figure out how to pass this in automatically so that I don't get prompted. I've tried many ways (a few examples below) but get prompted every time:
./script.ps1 -deployVM "vmname"
./script.ps1 "vmname"
./script.ps1 -deployVM vmname
./script.ps1 vmname
Invoke-Expression -Command script.ps1 vmname
Invoke-Expression -Command script.ps1 "vmname"
Does anybody have any suggestions as to what i'm doing wrong?
Many thanks