I am working on a team site collection inside my sharepoint enterprise 2013. and i have defined a global workflow linked to one of our custom site content types. now i am facing a problem is that whenever i create a new list which uses the custom content type, then the global workflow will show a status field as follow when an new item is created:-

enter image description here

now i search for a solution for this issue, such as setting the workflow to not create such a list column, but seems this can not be achieved as there is not such a setting inside the workflow.

now i am asking if i can implement such as workaround:-

  1. create a power-shell script and schedule it to run let say each 30 minutes using windows scheduler tool.
  2. the power-shell script will loop through all the current sub-sites inside the site collection.
  3. then for each sub-site to loop through its lists.
  4. and for each list to hide the list column (named AssingItemNumber in my case) if it is presented.

so in this case whenever i create a new list , and I add a new item, then the workflow status column will be shown ,, and after 30 minutes or less it will be removed by the power-shell script.

so can anyone adivce on this appraoch please?


1 Answer 1


Try below code:

$SiteCollection = Get-SPsite "https://sitecollectionurl" 

foreach($Site in $SiteCollection)
    #Loop through all Sub Sites
   foreach($Web in $Site.AllWebs)
     Write-Host $web.title ": " $web.URL         
     $spList = $web.Lists.TryGetList("List")
     if($spList -ne $null){
         $spView = $spList.DefaultView
         #check if defaultview contains the column
         if ($spView.ViewFields.SchemaXml.Contains("AssingItemNumber")){
             $spView.ViewFields.Delete("AssingItemNumber") #use internal column name
  • so what will be the exact implication of this script ? will it be exactly similar to un-checking the field by modifying the related list view using the UI ? in other words is running such a code on a schedule basis considered safe ?
    – John John
    Jan 5, 2017 at 23:40
  • Yes its similar to unchecking the list view using UI and its perfectly safe. Jan 6, 2017 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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