3

On server 2012 R2, I'm mounting SQLServer media as a drive (works), but every time I launch the install using "Start-Process", the error "A positional parameter cannot be found that accepts argument '$null'" is always generated even though my paths and argumebnts are good (the install completes successfully).

$sqlreturn = Start-Process -FilePath "$DVDDriveLetter`\Setup.exe" -ArgumentList "$ArgumentList" -Wait

The install works, I do have a long Argument list, as a collection, which is also recognized correctly (all paramenters work for SQL). I have it write out the arguments using a foreach loop with Write-Verbose and eveything is recognized by Start-Process parameter "-ArgumentList" properly:

Write-Verbose "--- Full Argument List:"
foreach ($arg in $ArgumentList) {Write-Verbose $arg}

VERBOSE: --- Full Argument List:
VERBOSE: /ACTION=Install
VERBOSE: /IACCEPTSQLSERVERLICENSETERMS
VERBOSE: /X86=False
VERBOSE: /TCPENABLED=1
VERBOSE: /SQLSYSADMINACCOUNTS=DOMAIN\server_admins DOMAIN\SQLServer_admins
VERBOSE: /QS
VERBOSE: /FEATURES=SQLENGINE,REPLICATION,FULLTEXT,BIDS,CONN,IS,BC,SDK,BOL,SSMS,ADV_SSMS,SNAC_SDK
VERBOSE: /INSTANCENAME=MSSQLSERVER
VERBOSE: /INSTANCEID=MSSQLSERVER
VERBOSE: /SQLBACKUPDIR=C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup
VERBOSE: /SQLUSERDBDIR=C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data
VERBOSE: /SQLUSERDBLOGDIR=C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data
VERBOSE: /SQLTEMPDBDIR=C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data
VERBOSE: /SQLTEMPDBLOGDIR=C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Data
VERBOSE: /SQLSVCACCOUNT=DOMAIN\MSAAccount1$
VERBOSE: /AGTSVCACCOUNT=DOMAIN\MSAAccount2$
VERBOSE: /ISSVCACCOUNT=DOMAIN\MSAAccount3$
VERBOSE: /SAPWD=System.Security.SecureString
VERBOSE: /SECURITYMODE=SQL

So why do I always get the error "A positional parameter cannot be found that accepts argument '$null'" with Start-Process even though the install works correctly?

4
  • Does the error occur after the new process exits or before?
    – Ben N
    Jul 12, 2016 at 18:04
  • After it exits.
    – Mark
    Jul 12, 2016 at 18:16
  • If you run the command without assigning the return to a variable, does it produce the same error? Jul 12, 2016 at 22:57
  • does the SA pwd get set correctly?
    – SimonS
    Jul 14, 2016 at 8:21

1 Answer 1

1

It turns out the issue was a missing "-PassThru" parameter as by default, the Start-Process cmdlet generates no output - so the error was me attempting to assign null to the "$sqlreturn" variable

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .