Hello,
I am using Nomad on windows 10 to schedule a job to run few python scripts however I want the scripts to be run as a different user other than the account that is tagged to the client service so I wrote a wrapper that will launch a new powershell terminal as a different user. The Wrapper works fine when I run it within the VM however when I run the job in Nomad to run this wrapper via powershell, it fails to open the new powershell terminal with a different user with this info in the eventlog.
"Application popup: powershell.exe - Application Error : The application was unable to start correctly (0xc0000142). Click OK to close the application. "
Wrapper:
$SecurePassword = ConvertTo-SecureString $password -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential $username,$SecurePassword
$Credential
Start-Process -FilePath “powershell” -ArgumentList “-file D:\data_query_yesterday.ps1” -Credential $Credential
Job Spec to call the wrapper:
task “Pull” {
driver = "raw_exec"
config {
command = "powershell"
args = ["D:\\DataQuery_Wrapper.ps1"]
}
Has anyone faced this issue or has any idea how to resolve this? I basically want to run a python script with a different user.