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
}
@Iristyle
Copy link
Author

Iristyle commented Mar 29, 2018

Hey @glennsarti - any idea where you got 6 from at https://github.com/puppetlabs/puppetlabs-scheduled_task/blob/dfca56dfc7077010c607f648eecde9193bfb3a36/lib/puppet_x/puppetlabs/scheduled_task/taskscheduler2.rb#L28 ?

Based on my digging around, that doesn't seem right... I think Windows 10 compat is the same as Windows 8 / Server 2012R2.

Nothing in https://msdn.microsoft.com/en-us/library/windows/desktop/aa384138(v=vs.85).aspx indicates anything new in 10 - just a behavior change for an existing task type.

@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