You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Start-Process: Unable to load DLL 'api-ms-win-core-job-12-1-0.dll' #6561
The funny thing is that the commands actually run afterwards, just throw this exception first.
This is a problem when you run multiple commands in try-catch (as you normally should), which interrupts the rest of the try blocks and thus messes up execution.
TLDR if you run start-process in try-catch, anything that comes after start-process will be skipped.
Aditya Patwardhan (@adityapatwardhan) It looks like PowerShell Core needs another API set for Win 7. Do you know if there is a way to scan for compliance (static analysis) rather than checking at runtime?
$ $Error[0].exception.stacktrace
at Microsoft.PowerShell.Commands.NativeMethods.CreateJobObject(IntPtr lpJobAttributes, String lpName)
at Microsoft.PowerShell.Commands.ProcessCollection..ctor()
at Microsoft.PowerShell.Commands.StartProcessCommand.BeginProcessing()
at System.Management.Automation.Cmdlet.DoBeginProcessing()
at System.Management.Automation.CommandProcessorBase.DoBegin()
Ilya (@iSazonov) Same thing with current master GitCommitId: v6.1.0-preview.2-26-g84344cbb32ec5e2479e00394951832794bf37244
Unable to load DLL 'api-ms-win-core-job-l2-1-0.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Microsoft.PowerShell.Commands.NativeMethods.CreateJobObject(IntPtr lpJobAttributes, String lpName)
at Microsoft.PowerShell.Commands.ProcessCollection..ctor() in C:\Stuff\Sources\PowerShell\src\Microsoft.PowerShell.Commands.Management\commands\management\Process.cs:line 2551
at Microsoft.PowerShell.Commands.StartProcessCommand.BeginProcessing() in C:\Stuff\Sources\PowerShell\src\Microsoft.PowerShell.Commands.Management\commands\management\Process.cs:line 2018
at System.Management.Automation.Cmdlet.DoBeginProcessing() in C:\Stuff\Sources\PowerShell\src\System.Management.Automation\engine\cmdlet.cs:line 159
at System.Management.Automation.CommandProcessorBase.DoBegin() in C:\Stuff\Sources\PowerShell\src\System.Management.Automation\engine\CommandProcessorBase.cs:line 499
The fact that after almost 4 months this issue is still open indeed is puzzling. Win7 is officially supported, yet, PowerShell Core is completely broken on it. That means around HALF of your userbase. I'd recommend to either declare Win7 unsupported or fix this critical blocker.
But I can't just say to my users that "yeah, your OS is theoretically supported, except in practice it won't work". I can't say "a fix is in the works" either coz I haven't seen any real activity on the matter.
Wait-UntilTrue : The term 'Wait-UntilTrue' is not recognized as the name of a cmdlet, function, script file, or... :( how are you using it? are you adding something else? Oh did you have to add that module manually and load it for it to work?
UPDATE: yeah i added the module manually and it does work as a workaround thanks a lot even if it is sort of a hack 👍
The issue happens only then Start-Process using -Wait argument.
Start-Process creates ProcessCollection to monitor child processes which calls NativeMethods.CreateJobObject (
).
According to unofficial info this api set was introduced in Windows 8 ( https://www.geoffchappell.com/studies/windows/win32/apisetschema/history/sets62.htm ).
For some strange reason this api set dll did not included in PowerShell distribution, but many other non "windows 7" api set dll were included.
So to fix this bug "api-ms-win-core-job-l2-1-0.dll" should be added to redistribute api set files list (
Activity
gradinkov commentedon Apr 4, 2018
Actually, way easier to repro:
gradinkov commentedon Apr 4, 2018
Same on 6.1.0-preview1 x86. The user that reported this problem to me uses x64 tho, so apparently this issue affects both arches.
iSazonov commentedon Apr 5, 2018
gradinkov Please replace first repo with simple second in the issue description.
iSazonov commentedon Apr 5, 2018
Mike Richmond (@mirichmo) Could you please comment the Issue?
gradinkov commentedon Apr 5, 2018
Sure thing, done!
gradinkov commentedon Apr 5, 2018
The funny thing is that the commands actually run afterwards, just throw this exception first.
This is a problem when you run multiple commands in try-catch (as you normally should), which interrupts the rest of the try blocks and thus messes up execution.
TLDR if you run
start-processin try-catch, anything that comes after start-process will be skipped.mirichmo commentedon Apr 5, 2018
Aditya Patwardhan (@adityapatwardhan) It looks like PowerShell Core needs another API set for Win 7. Do you know if there is a way to scan for compliance (static analysis) rather than checking at runtime?
adityapatwardhan commentedon Apr 5, 2018
The binary does not seem to be in the API set we use :
runtime.win7-x64.Microsoft.NETCore.Windows.ApiSets/1.0.1. This needs further investigation.Arnavion commentedon May 3, 2018
I hit this on 6.0.1 on win7 x64.
iSazonov commentedon May 3, 2018
Arnav Singh (@Arnavion) Please test with lates PowerShell Core build https://github.com/PowerShell/PowerShell#build-status-of-master-branches
Arnavion commentedon May 3, 2018
Ilya (@iSazonov) Same thing with current master
GitCommitId: v6.1.0-preview.2-26-g84344cbb32ec5e2479e00394951832794bf37244iSazonov commentedon May 3, 2018
Arnav Singh (@Arnavion) Thanks for confirmation!
meekaah commentedon Jul 24, 2018
any news? this is completely blocking us 👎 i still havent found a workaround
we're running windows server 2008 r2
gradinkov commentedon Jul 24, 2018
The fact that after almost 4 months this issue is still open indeed is puzzling. Win7 is officially supported, yet, PowerShell Core is completely broken on it. That means around HALF of your userbase. I'd recommend to either declare Win7 unsupported or fix this critical blocker.
But I can't just say to my users that "yeah, your OS is theoretically supported, except in practice it won't work". I can't say "a fix is in the works" either coz I haven't seen any real activity on the matter.
iSazonov commentedon Jul 24, 2018
Looking https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-createjobobjecta
I guess we could directly reference Kernel32.dll
adityapatwardhan commentedon Jul 28, 2018
I found a workaround for the issue.
The issue is with
-Wait. You can use-PassThruand wait for the process completion. Something like this:The function
Wait-UntilTrueis defined here:https://github.com/PowerShell/PowerShell/blob/master/test/tools/Modules/HelpersCommon/HelpersCommon.psm1#L3
gradinkov meekaah Arnav Singh (@Arnavion)
meekaah commentedon Aug 3, 2018
Wait-UntilTrue : The term 'Wait-UntilTrue' is not recognized as the name of a cmdlet, function, script file, or... :( how are you using it? are you adding something else? Oh did you have to add that module manually and load it for it to work?
UPDATE: yeah i added the module manually and it does work as a workaround thanks a lot even if it is sort of a hack 👍
adityapatwardhan commentedon Aug 3, 2018
meekaah The function is defined the link I posted above.
PowerShell/test/tools/Modules/HelpersCommon/HelpersCommon.psm1
Lines 3 to 24 in ac8ac4f
fdge commentedon Aug 22, 2018
This error is slowing me down from moving From PowerShell to Core
This error happens on Server 2008 R2 but not on Windows 10 1709
ajax16384 commentedon Feb 2, 2019
The issue happens only then Start-Process using -Wait argument.
Start-Process creates ProcessCollection to monitor child processes which calls NativeMethods.CreateJobObject (
PowerShell/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs
Line 2585 in 003a141
"CreateJobObject" declared using pinvoke that points to "api-ms-win-core-job-l2-1-0.dll"(
PowerShell/src/System.Management.Automation/utils/PInvokeDllNames.cs
Line 84 in 003a141
According to unofficial info this api set was introduced in Windows 8 ( https://www.geoffchappell.com/studies/windows/win32/apisetschema/history/sets62.htm ).
For some strange reason this api set dll did not included in PowerShell distribution, but many other non "windows 7" api set dll were included.
So to fix this bug "api-ms-win-core-job-l2-1-0.dll" should be added to redistribute api set files list (
PowerShell/assets/files.wxs
Line 74 in 003a141
Quick dirty fix: droping api-ms-win-core-job-l2-1-0.dll from "windows8/system32" installation to window7/PowerShell/6/ folder will solve issue
install: Fix bug with Start-Process -Wait, exclusive to PowerShell Co…
github.com/PowerShell/PowerShell/issues/6561
ferenczy commentedon Aug 22, 2019
One and a half years ago and the issue is still present. Could you let us know what's the plan with this bug, please?
Windows 7 Ultimate 64-bit
PowerShell Core 6.2.2