positional parameter cannot be found that accepts argument

Viewed 2614
if ($mbcb1.Checked -eq $true) {$dgr = "-AutoStart"}

if ($mbcb2.Checked -eq $true) {$dgrc = "-AutoComplete"}

if ($mbcb3.Checked -eq $true) {$dgren = "-NotificationEmails"}

New-MigrationBatch -Name $mbnd -SourceEndpoint $mbcx -TargetDeliveryDomain $mbtdd -CSVData ([System.IO.File]::ReadAllBytes("$cmbcsvfile")) $dgr $dgrc $dgren admin@admin.com


Error : 
A positional parameter cannot be found that accepts argument '-Autostart'.
    + CategoryInfo          : InvalidArgument: (:) [New-MigrationBatch], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,New-MigrationBatch
    + PSComputerName        : ps.outlook.com

if i given direct input its working but passing as variable throwing error.

1 Answers
Related