Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export-DbaInstance - Cannot bind argument to parameter Path #9578

Open
TheBaliBowie opened this issue Jan 19, 2025 · 2 comments
Open

Export-DbaInstance - Cannot bind argument to parameter Path #9578

TheBaliBowie opened this issue Jan 19, 2025 · 2 comments
Labels
bugs life triage required New issue that has not been reviewed by maintainers

Comments

@TheBaliBowie
Copy link

TheBaliBowie commented Jan 19, 2025

Verified issue does not already exist?

Yes I did search

What error did you receive?

After calling Export-DbaInstance like:

#Create relevant path for .sql files
$Path = "C:\Apps\Export-DbaInstance"

if (-Not (Test-Path -Path $Path)) {
New-Item -ItemType Directory -Path $Path
}

#Export the .sql files
Try {
Export-DbaInstance -SQLInstance $SQLServer -Path $Path -ExcludePassword -Force -EnableException
}
Catch {
...
}

I intermittently receive the error:

Export-DbaSpConfigure : Cannot bind argument to parameter Path because it is an empty string.
At line:14464 char:17

  • ... Export-DbaSpConfigure -SqlInstance $server -FilePath "$ex ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Export-DbaSpConfigure], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Export-DbaSpConfigure

This doesn't happen all the time and is run over 10's of servers and I cannot see the issue?

Any help appreciated.

Steps to Reproduce

#Create relevant path for .sql files
$Path = "C:\Apps\Export-DbaInstance"

if (-Not (Test-Path -Path $Path)) {
New-Item -ItemType Directory -Path $Path
}

#Export the .sql files
Try {
Export-DbaInstance -SQLInstance $SQLServer -Path $Path -ExcludePassword -Force -EnableException
}
Catch {
...
}

Please confirm that you are running the most recent version of dbatools

Version Name Repository Description


2.1.8 dbatools PSGallery The community module that enables SQL Server Pros to automate database development and server administration

Other details or mentions

No response

What PowerShell host was used when producing this error

Windows PowerShell (powershell.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.20348.2849
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.2849
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

Microsoft SQL Server 2019 (RTM-CU29-GDR) (KB5046860) - 15.0.4410.1 (X64)

.NET Framework Version

.NET Framework 4.8.4770.0

@TheBaliBowie TheBaliBowie added bugs life triage required New issue that has not been reviewed by maintainers labels Jan 19, 2025
@niphlod
Copy link
Contributor

niphlod commented Jan 20, 2025

I cannot reproduce.
Are you SURE the script is the one you put in the issue ? Asking because sometimes users will open issues with a "simplified" script version and the culprit is a more complicated original script rather than the simple one used for opening the issue.

Also:

  • does it happen when you don't pass the -Path ?
  • did you try, just for the sake of eliminating issues of variable scoping, naming the value you pass to -Path as a unique variable name, such as $thisIsTheTargetPath = "C:\Apps\Export-DbaInstance" ?

@TheBaliBowie
Copy link
Author

I haven't tried not passing -Path although I have updated my script to not use the variable name $Path as this may be causing the issue as it's the same name as the parameter?

The issue seems to be with the DBATools code after the parameter value is passed down to here:

Export-DbaSpConfigure : Cannot bind argument to parameter Path because it is an empty string.
At line:14464 char:17

I'll see how the new version goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs life triage required New issue that has not been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants