Skip to content

Update Copy-DbaInstanceAudit.ps1 - bug 10113#10116

Merged
potatoqualitee merged 4 commits intodataplat:developmentfrom
Ant-Green:Copy-DbaInstanceAudit_PathFix
Jan 29, 2026
Merged

Update Copy-DbaInstanceAudit.ps1 - bug 10113#10116
potatoqualitee merged 4 commits intodataplat:developmentfrom
Ant-Green:Copy-DbaInstanceAudit_PathFix

Conversation

@Ant-Green
Copy link
Contributor

@Ant-Green Ant-Green commented Jan 27, 2026

Path is only needed to be tested when using audit to file, other types like security log, app log, url, external monitor we don't need to check the path

Type of Change

Purpose

Fix substring errors when copying audits which don't go to files

Approach

Checks the destination type and only checks file path on file dest types

Commands to test

Screenshots

Works with -force but throws errors about test-path and substring
image

After modification, checking the test-path for only $surrentAudit.DestinationType -eq "File" works in both Force and Non-Forced modes
image

Learning

Path is only needed to be tested when using audit to file, other types like security log, app log, url, external monitor we don't need to check the path
$rootUnc = Join-AdminUnc $resolvedComputerName $root

if ((Test-Path $rootUnc) -eq $true) {
if ((Test-Path $rootUnc) -eq $true ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove that new space.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Copy link
Collaborator

@andreasjordan andreasjordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this bug.

@potatoqualitee
Copy link
Member

thank you both, and thank you for the approval andreas 🙏🏼

@potatoqualitee potatoqualitee merged commit e8590ab into dataplat:development Jan 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy-DbaInstanceAudit - Throwing multiple errors, however still copies, I guess down to EXTERNAL_MONITOR and not a SQLAudit path

3 participants