Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to send array of strings #15

Closed
shareiff opened this issue Jan 26, 2017 · 3 comments
Closed

Unable to send array of strings #15

shareiff opened this issue Jan 26, 2017 · 3 comments
Assignees

Comments

@shareiff
Copy link

I am unable to send an array of Strings. When I send a JS array it reads it as one long string in the powershell script (i.e. it only loops through once in my powershell foreach loop) . I've also tried sending it formatted as a powershell array @()

JS

let users = ["account1", "account2"]
let params = [{name: 'Accounts', value: users}]
ps.addCommand(filePath + 'Enable-ADUser.ps1', params)
return ps.invoke()

Powershell

Param (
   [Parameter(Mandatory = $true)]
   [String[]] $Accounts
)

Not sure where I'm going wrong. Are we able to send an array to powershell?

Thank you!

@rannn505 rannn505 self-assigned this Jan 29, 2017
@rannn505 rannn505 added the bug label Jan 29, 2017
@rannn505
Copy link
Owner

Hey @shareiff ,
Thank you for helping me find this bug.
Anyway I will make some tests, fix it, and come out with a new version, soon. 🥇

@shareiff
Copy link
Author

Thanks! no rush, I figure I can just wrap the ps.addCommand() in a for-loop

@rannn505
Copy link
Owner

rannn505 commented Mar 2, 2017

Hey @shareiff
Please check out the new features entered in the last commit.
Thx. 👍

@rannn505 rannn505 closed this as completed Mar 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants