This used to work with a new Windows 10 device which came pre-installed with Windows 10….. But then I saw a 1511 update that had come through in Windows Updates, so I upgraded Windows to Windows 10 version 1511, this was classed as an upgrade, not just a normal update.
I then started to get a bug when trying to run the following PowerShell to add in a scheduled task:
$L = New-ScheduledTaskAction –Execute "`"${env:ProgramFiles(x86)}\Winamp\Winamp.exe`"" -Argument "$env:SystemDrive\Music\playlist.m3u8" $T = New-ScheduledTaskTrigger -AtLogOn -User FredSmith $P = New-ScheduledTaskPrincipal -UserId "$env:COMPUTERNAME\FredSmith" -LogonType Password $S = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries Register-ScheduledTask -TaskName "Winamp Playlist" -Action $L -Trigger $T -Settings $S
The error was…..
New-ScheduledTaskTrigger : Method "NewTriggerByLogon" not found At line:1 char:6 + $T = New-ScheduledTaskTrigger -AtLogOn -User ejukebox + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [New-Sche duledTaskTrigger], CimException + FullyQualifiedErrorId : HRESULT 0x80041002,New-ScheduledTaskTrigger
I looked online and researched, then cam accross this fix – run this below in PowerShell as administrator.
mofcomp C:\Windows\System32\wbem\SchedProv.mof
Problem solved…. I will report this through to the powers that be in Microsoft.