Created
March 28, 2018 06:26
-
-
Save Iristyle/8a6e6f247a5d28d70ccd7aae889666fb to your computer and use it in GitHub Desktop.
Get scheduled tasks with compat
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
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 | |
} |
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.
Windows 10 1709
def enum
result = @tasksched.task('\\Dell SupportAssistAgent AutoUpdate')
defn = @tasksched.task_definition(result)
puts "compat = #{ @tasksched.compatibility(defn)}"
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
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
Uncovered a little bit more info by looking at return values from COM components and comparing them to the CIM output:
On a Windows 10 machine
10.0.14393.0
/ templatewin-10-1607-x86_64
On a Windows 2016 machine
10.0.14393.0
/ templatewin-2016-x86_64