Remove Information when running a script

Hello,
When i run my script, at the start it gives the following three messages as output:

  • Security Protocol now set to TLS 1.2
  • PWPS_DAB Version is 2.1.18.0
  • This is a 64-bit process.

Since I want to create an .exe-file with this script, i need to disable these messages. Otherwise they will appear one after the other on the screen until I confirm all three of them.

Any ideas on how to disable/remove them? Picture is attached.

Best regards,
Daniel
Unbenannt

Hi, welcome to the forum :wave:

My guess, as they’re not prepended by ‘VERBOSE:’ or another keyword, is that they’re being output by a Write-Host or Write-Output command. Have you search the code for those strings to see what’s outputting them?

You’ll probably have more luck searching for just part of the string, e.g. ‘Security Protocol’ because the values may be variables.

If that doesn’t help then you’ll need to share the script; without it, we can only guess.

When sharing the script, please remember to format it as code:

How to format code on PowerShell.org

Hi Matt,

thank you. Sadly it is not a Write-Host or a similar command
I use the module pwps_dab and this is the part of the code where this problem occures

    $PWLoginName = $userNameBox.Text
    $PWPassWord = $PasswordBox.Text | ConvertTo-SecureString -AsPlainText -Force

    $PWLogin = @{
        DataSourceName = $PWdatasource
        UserName = $PWLoginName
        Password = $PWPassWord
        }

    $LoginPW = New-PWLogin -InformationAction SilentlyContinue -ErrorAction SilentlyContinue -WarningAction SilentlyContinue @PWLogin

The messages appear when I run the New-PWLogin command.
I tried to hide them with -InformationAction SilentlyContinue for example but that didn’t help either

BR
Daniel

If you look in the module, you’ll see that those are output by the pwps_dab.ps1 script.

The script doesn’t appear to do anything except output that information, however, you can’t edit it because it’s signed.

In the current version, comment out line 27, in the module manifest pwps_dab.psd1

ScriptsToProcess="pwps_dab.ps1"

You might be able to hide it with using Out-Null

i.e.

$LoginPW = New-PWLogin -InformationAction SilentlyContinue -ErrorAction SilentlyContinue -WarningAction SilentlyContinue @PWLogin | out-null

I would test this and make sure it stores the correct information in your variable.