Skip to content

-Credential switch for invoke-dbccheck is not passing the specified credentials #1012

Open
@ap-tnt

Description

Bug Report

General Troubleshooting steps

  • Verified running the latest release of dbachecks?

Does (Find-Module dbachecks).Version match (Get-Module dbachecks).Version.ToString()
Yep

  • Verified errors are not related to permissions?
  • Can duplicate in new/clean PowerShell session (clean = powershell -NoProfile)?

Version Information

  • Operating System (Name|Version): Windows 10 21H2
  • PowerShell Version: 5.1.19041.3031
  • SQL Server (Edition|Version): Microsoft SQL Server 2016 13.0.6430.49 (X64) Standard Edition

Steps to Reproduce

$cred = Get-Credential -UserName 'domain\user1'
invoke-dbccheck -sqlinstance "sql01" -check lastgoodcheckdb -Credential $cred

Description of Bug

I would like the above code to connect to sql01 using the domain\user1 account. However, it runs invoke-dbccheck as the user who is running Powershell. I can verify that the credentials running Powershell are being used to connect to sql01, as there are login failures on sql01 relating to said user, and the credentials running Powershell do not have any permissions to connect to sql01.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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