Skip to content

Unable to suppress warning message and capture the message in a variable #9658

Open
@pshum777

Description

@pshum777

Verified issue does not already exist?

No, I did not search

What error did you receive?

Attempt to capture warning from Get-DbaNetworkCertificate and suppress the display

as described in this article: https://nocolumnname.blog/2019/06/28/hiding-warnings-in-dbatools/

Steps to Reproduce

$WarningToDo = @{
WarningAction = 'SilentlyContinue'
WarningVariable = 'RestoreWarning'
}

Get-DbaNetworkCertificate -SqlInstance sqldb1211.shoebox56.org @WarningToDo
$RestoreWarning

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

Get-InstalledModule -Name dbatools

Version Name Repository Description


2.1.27 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 ISE (powershell_ise.exe)

PowerShell Host Version

Name Value


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

SQL Server Edition and Build number

sql server 2019 EE CU 29

.NET Framework Version

.NET Framework 4.8.9300.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions