SOLVED

Read-Host not working with multiple input

%3CLINGO-SUB%20id%3D%22lingo-sub-61067%22%20slang%3D%22en-US%22%3ERead-Host%20not%20working%20with%20multiple%20input%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-61067%22%20slang%3D%22en-US%22%3E%3CP%3EAnyone%20got%20a%20explanation%20why%20this%20is%20happening%3F%20Also%20tried%20with%20%22%20around%20the%20text%20in%20the%20input.%3C%2FP%3E%3CP%3ERead-host%20seems%20to%20work%20if%20i%20only%20input%20one%20thing%20like%3A%20Sway%3C%2FP%3E%3CP%3ENot%20working%20when%20inputting%3A%20sway%2Cyammer_enterprise%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%221.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F13054iAB619AF1CBFFA3BB%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%221.PNG%22%20alt%3D%221.PNG%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F13056iE5D374EE6B483B57%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222.PNG%22%20alt%3D%222.PNG%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%3E%3CIMG%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%224.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F13057iF49FE7556D5092FB%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%224.PNG%22%20alt%3D%224.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-61067%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-61244%22%20slang%3D%22en-US%22%3ERe%3A%20Read-Host%20not%20working%20with%20multiple%20input%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-61244%22%20slang%3D%22en-US%22%3E%3CP%3Eah%2C%20so%20without%20the%20split%20powershell%20see%20it%20as%20one%20long%20object%2Fvalue.%20%26nbsp%3B%20%26nbsp%3BThanks%20for%20that%20one.%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-61188%22%20slang%3D%22en-US%22%3ERe%3A%20Read-Host%20not%20working%20with%20multiple%20input%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-61188%22%20slang%3D%22en-US%22%3E%3CP%3EYou're%20passing%20a%20String%20value%2C%20it%20needs%20to%20be%20list.%20Try%20it%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24newSKU%20%3D%20New-MsolLicenseOptions%20-AccountSkuId%20tenant%3ASKUID%20-DisabledPlans%20%24SelectedPlans.Split(%22%2C%22)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-61076%22%20slang%3D%22en-US%22%3ERe%3A%20Read-Host%20not%20working%20with%20multiple%20input%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-61076%22%20slang%3D%22en-US%22%3E%3CP%3EFound%20it%20out%2C%20had%20to%20do%20it%20like%20this.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%225.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F13059i23519395C988AC4F%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%225.PNG%22%20alt%3D%225.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
MVP

Anyone got a explanation why this is happening? Also tried with " around the text in the input.

Read-host seems to work if i only input one thing like: Sway

Not working when inputting: sway,yammer_enterprise

 

1.PNG2.PNG4.PNG

3 Replies
best response confirmed by Alexander H (MVP)
Solution

Found it out, had to do it like this.

5.PNG

 

You're passing a String value, it needs to be list. Try it like this:

 

$newSKU = New-MsolLicenseOptions -AccountSkuId tenant:SKUID -DisabledPlans $SelectedPlans.Split(",")

ah, so without the split powershell see it as one long object/value.    Thanks for that one.