PSV3 start-Jobs running from scheduled task with different credentials fail - by Karl Prosser

Status : 

 


6
0
Sign in
to vote
ID 736114 Comments
Status Active Workarounds
Type Bug Repros 2
Opened 4/9/2012 3:23:08 PM
Access Restriction Public

Description

When i have a scheduled job, that creates a start-job itself with a DIFFERENT credential. this fails. while the scheduled job is completed seemingly without an error the get-job of the parent reveals the error.

[localhost] The background process exited abnormally.
    + CategoryInfo          : OpenError: (localhost:String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : 2101,PSSessionStateBroken
    + PSComputerName        : localhost


likely to happen under V2
i also had something similar when remoting from A to B with one cred and doing start-job with another Cred on B in the past (in v2)
This also seems to happen to us when we create manual scheduled tasks (not v3 feature )
and also when instead of start-job we do start-process -wait powershell.exe
you can follow up with me on this offline if you want>
Sign in to post a comment.
Posted by Ronald Rink on 10/11/2014 at 6:10 AM
I observe the same behaviour also on PowerShell v4.0 (on Windows 2012 R2). See also my description on http://wp.me/p328Zb-ik
Posted by Karl Prosser on 4/16/2012 at 1:57 PM
i tried to see whether this was a powershell issue wiht start-job and start-process or related to windows/dotnet. so i made two console apps A and B, and A hard codedly called B with a different set of credentials.. I had the same issues, but with the error code 1073741502 or 0xC0000142 in hex which means "The application failed to initialize properly".
and this happened when running it with scheduled tasks, when calling A from localhost remoting the exception i'd trap would be

System.ComponentModel.Win32Exception (0x80004005): The directory name is invalid
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at callingconsoleapp.Program.Main(String[] args) in C:\TFS\runstate\Run State Servicing\KarlPOC\callingconsoleapp\callingconsoleapp\Program.cs:line 30

and when i set the startprocessinfo workingdirectory to something it all actually now works.. So maybe start-job and start-process with Credential aren't setting the workingdirectory properly?