question

proj964-1738 avatar image
0 Votes"
proj964-1738 asked VickyWang-MFST answered

Get-ScheduledTask -TaskName no longer works on my Win10

Windows 10 Pro, 20H2, 19042.985

PowerShell Commandlet Get-ScheduledTask -TaskName no longer accepts the 'TaskName' parameter.

It does have a -Name <Object>

However, lines like

Get-ScheduledTask -Name "Proxy"

return nothing. Hoping someone knows how to make this work again.

The command help for -Name is:

-Name <Object>
The name or name pattern of the scheduled task

Required? false
Position? 1
Default value *
Accept pipeline input? false
Accept wildcard characters? false

windows-10-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MotoX80 avatar image
0 Votes"
MotoX80 answered proj964-1738 commented

how do I find it?

Since your source is task scheduler, try this.


 ($env:PSModulePath -split ';' | get-childitem -recurse |  where-object -property fullname -match TaskScheduler).fullname


My source is "scheduledtasks",so I get this:


 PS C:\> ($env:PSModulePath -split ';' | get-childitem -recurse |  where-object -property fullname -match scheduledtasks).fullname
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\en-US
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\MSFT_ScheduledTask.format.ps1xml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\MSFT_ScheduledTask.types.ps1xml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\MSFT_ScheduledTask_v1.0.cdxml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\PS_ClusteredScheduledTask_v1.0.cdxml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\PS_ScheduledTask.types.ps1xml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\PS_ScheduledTask_v1.0.cdxml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\ScheduledTasks.psd1
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\ScheduledTasks_5378ee8e-e349-49bb-83b9-f3d9c396c0a6_HelpInfo.xml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\en-US\MSFT_ScheduledTask_v1.0.cdxml-help.xml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\en-US\PSScheduledJob.dll-help.xml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\en-US\PSScheduledJobPrxy.psm1-help.xml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\en-US\PS_ClusteredScheduledTask_v1.0.cdxml-help.xml
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\ScheduledTasks\en-US\PS_ScheduledTask_v1.0.cdxml-help.xml
 PS C:\>

Might be something you loaded in your Documents subfolder.

 PS C:\> $env:PSModulePath -split ';'
 C:\Users\Dave\Documents\WindowsPowerShell\Modules
 C:\Program Files\WindowsPowerShell\Modules
 C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
 C:\Program Files\Microsoft Message Analyzer\PowerShell\


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks to everyone for the help. Turns out there was a copy of PowerShellPack.2.0.zip installed in my ...documents\windowspowershell...
not sure how windows found the modules as the folder is not in the path.
but i renamed the folder and now it works as expected.

0 Votes 0 ·
cooldadtx avatar image
0 Votes"
cooldadtx answered cooldadtx commented

Get-ScheduledTask uses TaskName for the parameter, not Name. This hasn't changed and is working fine on my 21H1 version.

One theory I have is that you have installed a module that has its own Get-ScheduledTask commandlet that is replacing the existing one. The core command comes from the ScheduledTasks module which installs by default as part of Powershell 5.1 and Powershell Core 7.x. The versions I have are 1.0.0.0 because it hasn't been updated.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Run get-command.


 PS C:\> get-command get-scheduledtask
    
 CommandType     Name                                               Version    Source
 -----------     ----                                               -------    ------
 Function        Get-ScheduledTask                                  1.0.0.0    ScheduledTasks
0 Votes 0 ·
 PS C:\> get-command get-scheduledtask
    
 CommandType     Name                                               Version    Source
 -----------     ----                                               -------    ------
 Function        Get-ScheduledTask                                  1.0        TaskScheduler
    
  get-command get-scheduledtask -All | format-table commandtype, name, definition
    
 CommandType Name              Definition
 ----------- ----              ----------
    Function Get-ScheduledTask ...


If this is, in fact, from another module, how do I find it?

0 Votes 0 ·

It is another module, TaskScheduler. That is the old module from Powershell 2.0. PS 3+ introduced a newer module. Sounds like you installed the old module. Remove it and try again.

0 Votes 0 ·
VickyWang-MFST avatar image
0 Votes"
VickyWang-MFST answered

Hi,
I am glad to hear that your issue was successfully resolved. If there is anything else we can do for you, please feel free to post in the forum.
Best Regards,
Vicky

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.