1

Closed

Invoke-FromTask: Unable to run scheduled task (no message)

description

I'm trying to use the Invoke-FromTask command in the Boxstarter.Common with no success. Suggestions?
Windows PowerShell
Copyright (C) 2013 Microsoft Corporation. All rights reserved.

PS C:\Users\vagrant> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
4      0      -1     -1
PS C:\Users\vagrant> boxstarter

Boxstarter: Installing Chocolatey
Boxstarter Version 2.4.15
(c) 2014 Matt Wrock. http://boxstarter.org

Boxstarter: Disabling Automatic Updates from Windows Update
True
Boxstarter: Enabling Automatic Updates from Windows Update
PS C:\Users\vagrant> boxstartershell

C:\Users\vagrant>powershell.exe -ExecutionPolicy bypass -NoExit -Command "&'C:\Users\vagrant\AppData\Roaming\Boxstarter\BoxstarterShell.ps1'"

Welcome to the Boxstarter shell!
The Boxstarter commands have been imported from C:\Users\vagrant\AppData\Roaming\Boxstarter and are available for you to run in this shell.
You may also import them into the shell of your choice.

Here are some commands to get you started:
Install a Package:   Install-BoxstarterPackage
Create a Package:    New-BoxstarterPackage
Build a Package:     Invoke-BoxstarterBuild
Enable a VM:         Enable-BoxstarterVM
For Command help:    Get-Help <Command Name> -Full

For Boxstarter documentation, source code, to report bugs or participate in discussions, please visit http://boxstarter.org

PS C:\> Import-Module Boxstarter.Common

WARNING: The names of some imported commands from the module 'Boxstarter.Common' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.

PS C:\> Invoke-FromTask "DISM /Online /Online /NoRestart /Enable-Feature /Telnet-Client" -IdleTimeout 20

ERROR: The system cannot find the file specified.
Unable to run scheduled task. Message from task was
At C:\Users\vagrant\AppData\Roaming\Boxstarter\Boxstarter.Common\Invoke-FromTask.ps1:108 char:9
+         throw "Unable to run scheduled task. Message from task was $taskResult"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Unable to run s... from task was :String) [], RuntimeException
    + FullyQualifiedErrorId : Unable to run scheduled task. Message from task was
Closed Sep 16, 2014 at 5:16 AM by mwrock

comments

mwrock wrote May 4, 2014 at 5:50 PM

The Invoke-FromTask function was not intended to be called from a non boxstarter caller. Boxstarter creates a task when it starts a package install and then Invoke-FromTask injects the script into that existing task and runs it. To accomplish telnet install, you can just run cinst telnet-client -source WindowsFeatures. The Windows-Features chocolatey source is a wrapper for DISM and boxstarter can respond to its reboot status responses.

mwrock wrote May 4, 2014 at 5:53 PM

Keeping the issue open sinse I need to make this more explicit in Invoke-FromTask.