我正在尝试使用以下代码编写脚本以远程运行服务;我收到的是
Error:: AttributeError: winmgmts.Win32_Services
我尝试查看此博客WMI lib to start windows service remotely,但没有得到太多帮助。
def start_services():
c = wmi.WMI()
for services in c.Win32_Services(Name="Adobe Flash Player Update Service"):
result = services.startservice()
if result == 0:
print("Service :",services.name)
else:
print("Service Already is Start State")
start_services()
提及服务应启动
答案 0 :(得分:0)
尝试将File "main.py", line 45, in gameStart
gt = tmx_data.getTileImageByGid
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytmx/pytmx.py", line 214, in __getattr__
raise AttributeError
AttributeError
更改为c.Win32_Services
。
还有IndentationErrors。
方法c.Win32_Service
应该是startservice()
。
StartService()
是它的显示名称,您应该传递它的服务名称,应该是Adobe Flash Player Update Service
。
有效的代码是:
AdobeFlashPlayerUpdateSvc