Not completely off-topic, trying to use CM12 cmdlets.

 

I have an array:

 

$CM_Roles = @("'CM_Global_Administration','Full
Administrator','ALL'";"'CM_Global_Packagers','Application
Administrator','ALL'")

Two entries, separated with ";" and each one separated with ","

 

This works fine: foreach ($x in $CM_Roles) {$x}

'CM_Global_Administration','Full Administrator','ALL'

'CM_Global_Packagers','Application Administrator','ALL'

 

I have the single quotes and can use split to get another array:

 

foreach ($x in $CM_Roles) {$x -split ","}

 

'CM_Global_Administration'

'Full Administrator'

'ALL'

'CM_Global_Packagers'

'Application Administrator'

'ALL'

 

All good. Still with quotes.

 

But I need to pass the array to another ps-script, namely an x86 like that:

 

&"$env:SystemRoot\syswow64\WindowsPowerShell\v1.0\powershell.exe"
".\CM_Assign_Security.ps1" @cm_roles

 

But the script with this in it:

 

Foreach ($x in $args) {$x}

 

only returns the values without the single quotes or ',':

 

CM_Global_Administration Full Administrator ALL

CM_Global_Packagers Application Administrator ALL

 

I've also tried like a million variations, like with param() in the script.
Then I only get one array entry back.

 

For sure someone knows how to do that? And it is probably trivial, but
google wasn't helping.

Those examples never had to use quotes.

 

-R

 



Reply via email to