开始在交互式会话Windows服务 [英] Starting a Windows service in an interactive session

查看:243
本文介绍了开始在交互式会话Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个同事有一个需要在控制台模式下在Windows Server上运行,所以它可以访问到Windows交互式会话一个批处理脚本程序。服务器定期自动重启(有这台机器,我们没有在控制上运行的不相关的闭源应用程序)。在重新启动后,他希望自动启动Windows交互式会话和有此脚本运行,再加上服务需要也可以访问网络资源(CIFS驱动器,尤其是)。

A colleague has a batch script program which needs to to run on a Windows Server in console mode, so that it has access to a Windows interactive session. The server is rebooted at regular intervals automatically (there's an unrelated closed-source application that runs on this machine that we have no control over). After a reboot he wants to automatically start a Windows interactive session and have this script run, plus the service needs to also have access to network resources (CIFS drives, in particular).

下面是我们试过到目前为止:

Here's what we've tried so far:


  1. 开始为Windows服务。这种失败,因为Windows服务可以的或者的访问交互式会话的的网络资源,但从来没有两个。

  2. 用于Microsoft管理控制台添加脚本在启动时运行,然而,这并不工作。

  3. 使用的HKLM注册表键启动运行此脚本,但它只能被启动时,我们手动开启服务器的远程桌面会话。

  4. 创建计划任务。调用的程序没有访问交互Windows会话。

  1. Start as Windows service. This failed, since a Windows service can either have access to interactive session or to network resources, but never both.
  2. Used Microsoft management console to add the script to run at startup, however this did not work.
  3. Used an HKLM registry key to start to run this script, however it only gets started when we manually open a remote desktop session on the server.
  4. Creating a scheduled task. The program invoked did not have access to interactive windows session.

任何其他建议? (或者他错过了什么时,他成立了其中的一个建议?)

Any other suggestions? (Or maybe he missed something when he set up one of these suggestions?)

推荐答案

在案与桌面交互上的服务是不够的(我在哪里见过它不是案例屈指可数),你可以用AutoAdminLogon结合起来。下创建HKLM \\ SOFTWARE \\微软\\的Windows NT \\ CURRENTVERSION \\ Winlogon中三个(或四为一域)REG_SZ值:

In case "Interact with desktop" on the service is not enough (I have seen a handful of cases where it is not), you can combine it with AutoAdminLogon. Create three (or four for a domain) REG_SZ values under HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon:


  • DefaultUsername

  • DefaultPassword

  • defaultdomain文件

  • AutoAdminLogon

AutoAdminLogon应设置在的1,其他的是不言自明。

AutoAdminLogon should be set to the string "1", the others are self-explanatory.

显然,这已经足够大,以木星飞行安全问题通过。

Obviously this has security issues big enough to fly Jupiter through.

这篇关于开始在交互式会话Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆