我正在尝试使用PowerShell创建和启动Windows服务.
创建服务但是当我使用除一个特定名称之外的各种名称时无法启动该服务.
当我使用exe文件的名称创建服务时,它可以启动,但是当我给它一个不同的名称时,它无法启动.
我以管理员身份运行PowerShell脚本.
有什么建议吗?
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 { ....
Run Code Online (Sandbox Code Playgroud)
我得到的错误:Start-Service:由于以下错误,无法启动服务'Service1(Service1)':无法在计算机'.'上启动服务Service1.
当我尝试手动启动时,我得到:"错误1053:服务没有及时响应启动或控制请求"
powershell ×1