当前位置:Linux教程 - Linux - 如何在命令行下远程安装终端服务(windows2000)

如何在命令行下远程安装终端服务(windows2000)

原创:coolweis(coolweis)
来源:http://www.xfocus.org

如何在命令行下远程安装终端服务

by coolweis
[email protected]

在目前windows2000的远程溢出不断被发现的今天,入侵win2000已经不是什么太困难的事情了,但是如何更好的利用和控制呢?介绍一个好方法:终端服务。但是很多机器没有安装终端服务,那么我就给它装一个。其实这是一个很简单的事情。你需要做的仅仅是打三行命令而已。这里有一个前提就是,你已经通过其他手段获得了该机器的管理员或系统权限。那么接下来我们要做的就是给他开个终端服务!
先讲一下思路,思路很简单,就是windows2000有无人职守安装的工具,sysocmgr.exe。下面看看MSDN里面关于这个工具的介绍:

How to Add or Remove Windows 2000 Components with Sysocmgr.exe

--------------------------------------------------------------------------------
The information in this article applies to:

Microsoft Windows 2000 Advanced Server
Microsoft Windows 2000 Datacenter Server
Microsoft Windows 2000 Professional
Microsoft Windows 2000 Server

--------------------------------------------------------------------------------
SUMMARY
This article describes how to add or remove Windows 2000 components with the Sysocmgr.exe tool.
MORE INFORMATION
You can use the Sysocmgr.exe tool at a command prompt to add or remove Windows 2000 components. You can use the following command-line switches with Sysocmgr.exe:
/i:path to Sysoc.inf file, where path to Sysoc.inf file is the full path to the Sysoc.inf file, for example:
c:windowsinfsysoc.inf
/u:path to answer file, where path to answer file is the full path to the answer file that contains a list of items to add or remove.
/q - runs Sysocmgr.exe in quiet mode (without display pages)
/r - suppresses reboot (if needed)
NOTE: This procedure does not work and is unsupported with Microsoft Fax Service, COM+, and Distributed Transaction Coordinator. These are core components that are not removable.
The answer file can be any Windows 2000 answer file and only parses the [Components] and [NetOptionalComponents] sections. An example file is shown below:
[Components]
Netoc = on
Reminst = on
Paint = off
pinball = off
Solitaire = off

[NetOptionalComponents]
lpdsvc = 1
SimpTcp = 1
wins = 1
To start the installation or uninstallation of these components using Sysocmgr.exe, type the following command (file saved as c:ocm.txt):
sysocmgr /i: %windir%infsysoc.inf /u:c:ocm.txt
For more information, please refer to the unattended documentation.
需要了解更多内容请参看无人职守文档。
我的思路就是利用这个工具进行无人职守安装,在安装过程中不需要交互,不显示窗口,安装完毕后不重新启动计算机(最好不要随便重新启动人家的机器,如果需要可以不选这一选项)。终端服务安装完毕后必须重新启动后才有效。可以根据情况处理。
下面是安装终端服务的具体做法。
首先,telnet到该机器上面(具体怎么样上去不需要我说了吧),然后在命令行下输入如下三行命令:
c:>echo [Components] > c:aa
c:>echo TSEnable = on >>c:aa
c:>sysocmgr /i:c:winntinfsysoc.inf /u:c:aa /q /r
等待一段时间后这个sysocmgr运行完毕后就把这个终端服务装好了。但是现在还不能启动这个服务。如果不怕重新启动的化,完全可以去掉/r参数,重新启动后服务回自动启动。还可以通过更改注册表来改变终端服务监听的端口号。至于如何更改就不是本文所涉及的了,网上有很多命令行下修改注册表的工具。
到目前为止,基本上远程命令行下安装终端服务就介绍完了。其实这是很简单的,不知到别人是否早就想到并实现了,我在这里献丑了。希望不要被拿来干坏事。