• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2233
  • Last Modified:

Powershell: Suppress WARNING: The command completed successfully but no settings have been modified

Hi,

can anyone help me on this?
How can I suppress the yellow warning
"WARNING: The command completed successfully but no settings have been modified"
I'm running the command       
"Set-RemoteDomain -Identity "$Domain" -TNEFEnabled $false"
When the remotedomain already exists I'm getting this warning, but I rather don't have it in the output windows ;-)
Is there a way to suppres this
I've already tried
      $global:ErrorActionPreference = "SilentlyContinue"
      $global:WarningPreference = "SilentlyContinue"
But they don't seem to work :(
0
Filip Heens
Asked:
Filip Heens
1 Solution
 
SubsunCommented:
It looks like a bug
https://connect.microsoft.com/PowerShell/feedback/details/541500/warning-verbose-and-debug-streams-do-not-respect-action-preferences-the-way-they-should

You can use this workaround..
If (!(Get-RemoteDomain |?{$_.DomainName -eq "$Domain" -and $_.TNEFEnabled -eq $False})){
Set-RemoteDomain -Identity "$Domain" -TNEFEnabled $false
}

Open in new window

0
 
Filip HeensAuthor Commented:
Perfectly, this realy helped me in solving my problem...
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now