2

My current setup is as follows:

I have a vagrant file set up with provisioning:

config.vm.provision 'test', :type => 'shell', :path => "#{rootdir}/.build/vagrant-scripts/sandbox-test.ps1", :powershell_elevated_interactive => true, :args => ["1", "2"]

My power shell script is set up to print out the names individually:

Param(
[Parameter(Mandatory=$true, position=1)]
[string[]]$array
)

foreach($a in $array)
{
    $a
}

I'm aware that the above example has an incorrect format for its args, but can't figure out how to pass an array from the vagrantfile (which is written in ruby?) to my powershell script.

I would be fine with doing something such as this, which I know works for the time being:

foreach($a in $args)
{
    $a
}

However as soon as I want to introduce multiple arrays, this functionality will break unless I'm very specific about the size of different arrays.

I hope what I'm trying to do is clear enough, please feel free to ask for any more information and thanks in advance for any assistance.

0 Answers0