title: Cannot start service on computer '.'
body: <p>I'm trying to create and start a windows service using PowerShell.</p>
  
  <p>The service is created but cannot be started when I use various names besides one particular name. </p>
  
  <p>When I create the service with the name of the exe file it can be started but when I give it a different name it fails to start.</p>
  
  <p>I'm running the PowerShell script as administrator.</p>
  
  <p>Any advises?</p>
  
  <pre><code>function InstallService(
      [string] $MsDeployHost,
      [string] $ServiceName,
      [string] $DisplayName,
      [string] $ServicePath,
      [string] $ServiceDescription,
      [object] $Credential) {
      if($MsDeployHost -eq "local") {        
          New-Service -name $ServiceName -binaryPathName $ServicePath -displayName $ServiceName -StartupType Automatic
          Start-Service -name $ServiceName
      } else { ....  
  </code></pre>
  
  <p>The Error I get:
   Start-Service : Service 'Service1
   (Service1)' cannot be started due to the following error: 
   Cannot start service Service1 on computer '.'.</p>
  
  <p>When I try to start it manually I get:
  "Error 1053: The service did not respond to the start or control request in a timely fashion" </p>