Hi,
Trying to start any service using Start-ServiceAndDependencies I’m getting the error below.
<code>[Post-Installation] :: Failed to start the service [Spooler].
Error Record:
Message : Cannot find any service with service name 'Spooler'.
InnerException :
FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand
ScriptStackTrace : at Start-ServiceAndDependencies&lt;Process&gt;,
C:\Users\user1\Desktop\Toolkit\AppDeployToolkit\AppDeployToolkitMain.ps1: line 9585
at &lt;ScriptBlock&gt;, C:\Users\user1\Desktop\Toolkit\Deploy-Application.ps1: line 146
at &lt;ScriptBlock&gt;, &lt;No file&gt;: line 1
at &lt;ScriptBlock&gt;, &lt;No file&gt;: line 1
PositionMessage : At C:\Users\user1\Desktop\Toolkit\AppDeployToolkit\AppDeployToolkitMain.ps1:9585 char:49
+ [ServiceProcess.ServiceController]$Service = Get-Service -ComputerName $Compu …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Start-ServiceAndDependencies 17/10/2016 15:15:32 1076 (0x0434)</code></pre>
I tried using the display name too, same issue. Looking at line 9585 in AppDeployToolkitMain.ps1, I cannot see an issue and executing the command manually seems to work.
[ServiceProcess.ServiceController]$Service = Get-Service -ComputerName $ComputerName -Name $Name -ErrorAction 'Stop'
Any help appreciated.
What did you have as the computername?
I didn’t set it, so it should use local computer by default? According to the documentation anyway.
Stop-ServiceAndDependencies seems to work fine.
My bad, I killed the service process using Show-InstallationWelcome but forgot to remove the ‘BlockExecution’ parameter. So when it came to starting the service, it obviously failed.
In saying that, there is a definite problem with the ‘SkipDependentServices’ parameter in Stop/Start-ServicesAndDependencies.
-
If I run ‘start-serviceanddependencies Spooler -SkipDependentServices $true’, it fails with ‘[10-20-2016 13:00:30.749] [Initialization] [Test-ServiceExists] :: Failed check to see if service [Spooler] exists.’
-
Adding ‘SkipServiceExistsTest’, to fix the error above, and running ‘start-serviceanddependencies Spooler -SkipDependentServices $true -SkipServiceExistsTest’ fails with the error below. This is the initial problem I had.
<code>…\AppDeployToolkit> start-serviceanddependencies Spooler -SkipDependentServices $true -SkipServiceExistsTest
[10-20-2016 13:00:50.123] [Initialization] [Start-ServiceAndDependencies] :: Get the service object for service [Spooler].
[10-20-2016 13:00:54.657] [Initialization] [Start-ServiceAndDependencies] :: Failed to start the service [Spooler].
Error Record:
Message : Cannot find any service with service name 'Spooler'.
InnerException :
FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand
ScriptStackTrace : at Start-ServiceAndDependencies<Process>, …\AppDeployToolkit\AppDeployToolkitMain.ps1: line 9585
at <ScriptBlock>, <No file>: line 1
PositionMessage : At …\AppDeployToolkit\AppDeployToolkitMain.ps1:9585
char:49
+ … ]$Service = Get-Service -ComputerName $ComputerName -Name $Name -Erro …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</code>