powershell - Job Runner service unable to start due to logon failure -


i'm working powershell , need start job runner automatically once script run getting exception "unable start service due logon failure".

can me how can resolve error?

function servicestart($servicename){     try     {     write-host $("starting service " + $servicename)     $timeout = [system.timespan]::fromminutes(5)      $arrservice = get-service -name $servicename     if ($arrservice -eq $null)     {         write-host $("**error** no service named '" + $servicename + "'      found")         return $false     }     if ($arrservice.status -eq      [serviceprocess.servicecontrollerstatus]::running)     {         return $true     }     $arrservice.start()     try     {      $arrservice.waitforstatus([serviceprocess.servicecontrollerstatus]     ::running, $timeout)     }     catch [serviceprocess.timeoutexception]     {         write-verbose "timeout starting service $($arrservice.name)"         throw "timeout starting service $($arrservice.name)"     }     write-host $("started service " + $servicename)     return $true     }     catch     {     write-host $("**error** unable start service '$servicename'.      exception: " + $_.exception.message + ". innerexception: " +      $_.exception.innerexception)     throw $("**error** unable start service '$servicename'. exception: "      + $_.exception.message + ". innerexception: " +      $_.exception.innerexception)     } 


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -