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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -