Forum Discussion
Jhult1170
Feb 25, 2026Copper Contributor
stop expanding parentheses in a variable
Hello We have created a script using PowerShell and Box CLI to create groups in Box as a user request them. We have had success with the script until recently. We had a user request that failed...
Charlie34000
Mar 22, 2026MCT
Hi,
PowerShell is not expanding the parentheses — the issue is that your variable is passed without quotes, so Box CLI receives two separate tokens:
Test-Group(Name) _OwnerThis is why you get:
_Owner was unexpected at this timeTo fix it, you must preserve the quotes around the argument when calling Box:
$ClientName = "Test-Group(Name)";
$BoxClientOwnerName = "$ClientName`_Owner";
$BoxLOWGRPRaw = $( Box groups:create --json "`"$BoxClientOwnerName`"" );Or more cleanly:
powershell
$BoxLOWGRPRaw = Box groups:create --json $BoxClientOwnerName | ConvertFrom-Json;(Here PowerShell handles quoting correctly.)
The parentheses are not the problem — the missing quotes are.