Skip to content

Instantly share code, notes, and snippets.

@Iristyle
Created March 28, 2018 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Iristyle/8a6e6f247a5d28d70ccd7aae889666fb to your computer and use it in GitHub Desktop.
Save Iristyle/8a6e6f247a5d28d70ccd7aae889666fb to your computer and use it in GitHub Desktop.
Get scheduled tasks with compat
Get-ScheduledTask | % {
$props = [ordered]@{
TaskName = $psitem.TaskName
# note ErrorAction Ignore needed to prevent conversion problems
Compatibility = $psitem | Select -ExpandProperty Settings | Select -ExpandProperty Compatibility -ErrorAction Ignore
}
New-Object -TypeName PSObject -Property $props
}
@glennsarti
Copy link

Windows 10 1709

def enum
  result = @tasksched.task('\\Dell SupportAssistAgent AutoUpdate')
  defn = @tasksched.task_definition(result)
  puts "compat = #{ @tasksched.compatibility(defn)}"

@glennsarti
Copy link

image

@glennsarti
Copy link

C:\Users\glenn.sarti> Get-ScheduledTask -TaskName 'Dell SupportAssistAgent AutoUpdate' | Select TaskName, @{Name="CompatInt";Expression={[int]$_.
Settings.Compatibility}}, @{Name="Compat";Expression={$_.Settings.Compatibility}}

TaskName                           CompatInt Compat
--------                           --------- ------
Dell SupportAssistAgent AutoUpdate         0


@Iristyle
Copy link
Author

Answered the question about compatibility by looking at latest taskschd.h from Windows 10 SDK 10.0.17134.0 - see https://gist.github.com/Iristyle/ccf04cf085c43a72b7a57823319ebf53#file-taskschd-h-L828-L838

typedef 
enum _TASK_COMPATIBILITY
    {
        TASK_COMPATIBILITY_AT	= 0,
        TASK_COMPATIBILITY_V1	= 1,
        TASK_COMPATIBILITY_V2	= 2,
        TASK_COMPATIBILITY_V2_1	= 3,
        TASK_COMPATIBILITY_V2_2	= 4,
        TASK_COMPATIBILITY_V2_3	= 5,
        TASK_COMPATIBILITY_V2_4	= 6
    } 	TASK_COMPATIBILITY;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment