Created
October 31, 2020 01:58
-
-
Save Nillth/4df430a5c6dc30e1138ed507b50bae82 to your computer and use it in GitHub Desktop.
Allow users to select a number of tasks to enable/disable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.NOTES | |
=========================================================================== | |
Created on: 2020-10-31 12:55 PM | |
Created by: Marc Collins (Marc.Collins@Qlik.com) | |
Organization: Qlik Professional Services | |
Filename: QlikSense-Toggle-ReloadTasks.ps1 | |
=========================================================================== | |
.DESCRIPTION | |
Allow users to select a number of tasks to enable/disable | |
#> | |
$QlikSenseServer = "Sense01" | |
connect-qlik -computername $QlikSenseServer -trustallcerts -UseDefaultCredentials | |
#Get the Qlik Tasks Filter 0 = ReloadTasks | |
$qliktasks = get-qliktask -full -filter "tasktype eq 0" | |
#Present user with a list to slect tasks to toggle (can multi select) | |
$SelectedTasks = $qliktasks | Select-Object -Property Name, ID, Enabled, taskType, @{ | |
Name = "App"; E = { | |
$_.App.Name | |
} | |
}, Tags, CustomProperties | Out-GridView -PassThru -Title "Tasks to toggle" | |
##Alt (update the tag name and run to get all tagged tasks wihtout user interaction) | |
#$TagName = "CustomTag" | |
#$SelectedTasks = get-qliktask -full -filter "tags.name eq '$TagName'" | |
#Toggle Task Enabled/Disabled | |
$UpdatedTasks = foreach ($SelectedTask in $SelectedTasks) | |
{ | |
if ($SelectedTask.enabled) | |
{ | |
$SelectedTask.enabled = $false | |
} | |
else | |
{ | |
$SelectedTask.enabled = $true | |
} | |
Update-QlikReloadTask -id $SelectedTask.id -Enabled $SelectedTask.enabled | |
} | |
$UpdatedTasks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment