How can I get rid of these warning? If these warning cannot be eliminated how can I suppress them?

For instance, the warnings happen at this line:

$sourceWebSite = Get-SPWeb -Limit All -Identity "SomeSite" -EA 0
$sourceLibrary = $sourceWebSite.Lists["Record Library"] 
$sourceView = $sourceLibrary.Views["Credentialing"]

enter image description here

  • 2
    try this one "-WarningPreference SilentlyContinue" instead of -EA 0 – Waqas Sarwar MVP Jan 13 '14 at 23:26

Try by adding WarningAction:SilentlyContinue in the first line

  • thanks that did it: $sourceWebSite = Get-SPWeb -Limit All -Identity "SomeSite" -EA 0 -WA 0 – H A Jan 13 '14 at 23:50
  • Just a tip, you may want to leave ErrorAction alone, (remove -EA 0) in case you get an unexpected error. – Russell Jan 14 '14 at 0:43
  • Note that the correct format would be $WarningAction = 'SilentlyContinue' if you wanted to do it on another line. – Aron Foster Aug 11 '17 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.