Skip to content

Instantly share code, notes, and snippets.

@Nillth
Created May 26, 2023 02:25
Show Gist options
  • Save Nillth/2037cd3c1f28d9f968bd7a52f0256f4e to your computer and use it in GitHub Desktop.
Save Nillth/2037cd3c1f28d9f968bd7a52f0256f4e to your computer and use it in GitHub Desktop.
Toggle Selected NPrinting Publish Tasks
Connect-NPrinting
$Tasks = Get-NPTasks
$SelectedTasks = $Tasks |Out-GridView -OutputMode Multiple -Title "Select Tasks"
foreach($Task in $SelectedTasks){
$TaskDetails = Invoke-NPRequest -method Get -NPE -Path "tasks/publish/$($Task.id)"
$TaskDetails.enabled = $(-not $TaskDetails.enabled)
Invoke-NPRequest -method Put -NPE "tasks/publish/$($Task.id)" -Data $TaskDetails
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment