Skip to content

Invoke-Sqlcmd with -NewPassword throws: Value cannot be null. (Parameter 'path2') #109

@BeniFreitag

Description

@BeniFreitag

The documentation says -NewPassword can be used to change the password of a SQL Server Authentication login ID. When I run this Cmdlet it shows an error and it also changes the password:

Invoke-Sqlcmd -ServerInstance . -Username "TestLogin" -Password "OldPw" -NewPassword "NewPw"

Error:
Invoke-Sqlcmd: Value cannot be null. (Parameter 'path2')

Exception Details:

Message        : Value cannot be null. (Parameter 'path2')
ParamName      : path2
TargetSite     : Void Throw(System.String)
Data           : {}
InnerException :
HelpLink       :
Source         : System.Private.CoreLib
HResult        : -2147467261
StackTrace     :    at System.ArgumentNullException.Throw(String paramName)
                    at System.IO.Path.Combine(String path1, String path2)
                    at Microsoft.SqlServer.Management.PowerShell.GetScriptCommand.ProcessRecord()

Image

Environment:

  • Invoke-Sqlcmd Version: 22.4.5.1 (latest)
  • PowerShell 7.5.1 (latest)
  • Windows 11 (26100.4349, latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions