Error stopping a Windows Service

自古美人都是妖i 提交于 2020-01-01 19:38:14

问题


I am using PowerShell 1.0 on Windows Server 2003 x64. When executing the following statement, there is error below. Not every time this error occurs, and if this error occurs and I execute this command again, there is no error again! It is so weird. Any ideas what is wrong?

Stop-Service "SQLServerAgent" -Force -ErrorAction:stop

WARNING: Waiting for service 'SQL Server Agent (MSSQLSERVER) (SQLSERVERAGENT)' 
to finish stopping...
out-lineoutput : The OS handle's position is not what FileStream expected. Do n
ot use a handle simultaneously in one FileStream and in Win32 code or another F
ileStream. This may cause data loss.

thanks in advance, George


回答1:


This is bug in PowerShell.

Please see Lee Holmes' post for a Workaround: The OS handle's position is not what FileStream expected




回答2:


Workarounds didn't work for me. Switched to using start-transcript at the start of the script instead. Doesn't the output of the programs you run, but there are workarounds.



来源:https://stackoverflow.com/questions/1218969/error-stopping-a-windows-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!