Skip to content

If EXIST Logic check for Export-DbaCredential #8618

@DSQLJazzman

Description

@DSQLJazzman

Summarize Command's Functionality

Hello, can I suggest adding an "IF EXIST" Logic check to the function "Export-DbaCredential"?

This would aid during with migration or DR scripts, so that only missing credentials are created

Is there a command that is similiar or close to what you are looking for?

Yes

Technical Details

I would suggest adding the following to lines 191 & 194

sql += "IF NOT EXISTS(SELECT [name] FROM master.sys.credentials WHERE [name] = '$quotename') CREATE CREDENTIAL

as a prefix to the current sql += "CREATE CREDENTIAL

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions