In the check part it checks the $archive variable instead of $editor $editorArg = if ($archive -eq 'true') { "-nocompileeditor" } else { "" }