Get/Set SharEPoint List Item Moderation State

You can read the SharePoint list item moderation state using this command:


$moderationState = $item["_ModerationStatus"]

switch($moderationState) {
  0 {
    #Approved
  }
  
  1 {
    #Denied
  }
  
  2 {
    #Pending
  }
  
  3 {
    #Draft
  }
  
  4 {
    #Scheduled
  }
}

You can set the moderation state from within a workflow using the cmdlet Set-KFFinalModerationState