在Windows 2003 Server中,我有一个名为"SQL Server Reporting Services"的服务正在运行。
这个服务有时会停止,当我试图启动它时,它会给出一个错误:
'错误1069:由于登录失败,服务没有启动。'
之后,我会转到属性->登录->此帐户->提供用户名和密码。
应用更改后,我可以启动服务。
我该如何编写一个脚本来自动设置用户名和密码并启动服务?此外,是否有任何方法可以检查服务是否处于运行状态,如果没有,请编写登录步骤的脚本并启动它?
谢谢。
我建议为服务器2003安装powershell。
看看这个Powershell脚本来更改服务帐户。
您可以使用get-service
来查找服务是否正在运行。
以下内容可能会有所帮助。(对于Windows机器(
----> Refresh_SSRS.ps1
Stop-Service “SQL Server Reporting Services (SQLSRV)”
Start-Service “SQL Server Reporting Services (SQLSRV)”
$wc = New-Object system.net.webClient$wc
$cred = [System.Net.CredentialCache]::DefaultNetworkCredentials
$wc.Credentials = $cred
$src = $wc.DownloadString(“http://ComputerNamexxx/Reports_xxxxxx/Pages/Folder.aspx“)
---->Run in Task Scheduler - on a regular occurance - where the user account can be assoicated:
Powershell.exe
-ExecutionPolicy Bypass -File C:commandsRefresh_SSRS.ps1