PowerShell icon indicating copy to clipboard operation
PowerShell copied to clipboard

Write-Verbose : Cannot bind argument to parameter 'Message' because it is null

Open russ960 opened this issue 9 years ago • 0 comments

Fixed issue where default instance failed as the name would be truncated after the first character. Once this was done the code properly updates the startup parameters.

Here is the error I got::

`PS> Set-SQLStartupParameters "localhost" "-T1499" Write-Verbose : Cannot bind argument to parameter 'Message' because it is null. At line:22 char:23

  •     Write-Verbose $wmisvc.StartupParameters
    
  •                   ~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Write-Verbose], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.WriteVerbos eCommand

Exception calling "Substring" with "2" argument(s): "Index and length must refer to a location within the string. Parameter name: length" At line:38 char:50

  • ... ms += $oldparams | Where-Object {$_.Substring(0,2) -match '-d|-e|-l'}
  •                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : ArgumentOutOfRangeException

Exception setting "StartupParameters": "STARTUPPARAMETERS: unknown property." At line:46 char:13

  •         $wmisvc.StartupParameters = $paramstring
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
    • FullyQualifiedErrorId : ExceptionWhenSetting

WARNING: Startup Parameters for localhost updated. You will need to restart the service for these changes to take effect. PS>`

russ960 avatar Aug 11 '17 00:08 russ960