0

I have created a powrshell script for updating SharePoint List. When i run it shows all the backend processing to the console for example all the list schema info. I want it only show script created Out put (The only output with Write-Host) and not out of the box backend processing. Is there any command available to prevent that?

it shows counting like below when I use .add method of ArrayList where ever in script

0
1
2
3

and it shows List XML Schema when i store List items in some variable in the script like below:

Sealed                      : False
Version                     : 28
DisplayFormTemplateName     : DocumentLibraryForm
EditFormTemplateName        : DocumentLibraryForm
NewFormTemplateName         : DocumentLibraryForm
NewFormUrl                  : 
MobileNewFormUrl            : 
EditFormUrl                 : 
MobileEditFormUrl           : 
DisplayFormUrl              : 
MobileDisplayFormUrl        : 
Id                          : 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39009893A4DD0A05487AAE05EAE8D183333C003933922476541344B8A065CBACE8178D
ReadOnly                    : False
Name                        : NewsPage
NameResource                : Microsoft.SharePoint.SPUserResource
FeatureId                   : 00000000-0000-0000-0000-000000000000
Description                 : Used to create news articles.
JSLink                      : 
DescriptionResource         : Microsoft.SharePoint.SPUserResource
Hidden                      : False
  • This script is regarding SharePoint Developlemt !!! – SPBeginer Mar 1 '16 at 15:04
  • I have updated question.. please remove "On Hold" – SPBeginer Mar 1 '16 at 15:27
  • I'm sorry, but you ask how to suppress output in powershell, that is not a SharePoint question since the answer is the same regardless of what cmdlets you use – Robert Lindgren Mar 1 '16 at 15:39
  • find the line that's doing that (maybe SomeThing.Add()) and add " | Out-Null" in the end, and move on with your life :) – Tiago Duarte Mar 1 '16 at 16:23
0

Have you tried the Out-Null option? This suppresses output to the console.

Example: Verb-Noun -param acb | Out-Null

| improve this answer | |
  • Where I put that in script, In the begining, right? – SPBeginer Mar 1 '16 at 14:34
  • 1
    @SPBeginer, no, you add that at the end of all of the lines that are causing the output you don't want to see. Just add | Out-Null at the end of each line. – Dylan Cristy Mar 1 '16 at 16:49

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.