如何使用命令行界面管理远程 Windows Server?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/623922/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:07:53  来源:igfitidea点击:

How to admin a remote Windows Server with a command line interface?

windowspowershellremote-desktopremote-accessremote-administration

提问by Jader Dias

When I was a Linux admin I could do anything from the SSH command line. Now, as a Windows admin, I have to deal with the Windows Remote Desktop graphical interface, which I found to be inefective (slow) and hard to automate tasks in it.

当我还是 Linux 管理员时,我可以从 SSH 命令行执行任何操作。现在,作为 Windows 管理员,我必须处理 Windows 远程桌面图形界面,我发现它效率低下(速度慢)并且很难在其中自动执行任务。

a) Can I connect to a Windows Server through SSH or any encrypted connection with command line interface?

a) 我可以通过 SSH 或任何带有命令行界面的加密连接连接到 Windows Server 吗?

b) If yes can I do ANY administrative task?

b) 如果是,我可以做任何管理任务吗?

Examples:

例子:

  1. create a new virtual folder in IIS
  2. setup firewall ports
  3. restart services
  4. change user policies
  5. start desktop applications
  1. 在 IIS 中创建一个新的虚拟文件夹
  2. 设置防火墙端口
  3. 重启服务
  4. 更改用户策略
  5. 启动桌面应用程序

I know about the existence of Windows PowerShell 2.0 Remoting, but I don't know if it fullfills all conditions above

我知道 Windows PowerShell 2.0 Remoting 的存在,但我不知道它是否满足上述所有条件

My conclusion so far: from Windows PowerShell can do MOST but not ALL administrative tasks. And I still don't know if Windows PowerShell 2.0 Remoting uses an encrypted connection.

到目前为止,我的结论是:从 Windows PowerShell 可以完成大部分但不是所有的管理任务。我仍然不知道 Windows PowerShell 2.0 远程处理是否使用加密连接。

回答by Jay Bazuzi

PowerShellis what you're looking for. It is primarily targetted at system administration(although it's fanastic as a programmer's shell, too).

PowerShell正是您要找的。它主要针对系统管理(尽管它作为程序员的外壳也很出色)。

PowerShell v2 remoting is based on Windows Remote Management. See http://msdn.microsoft.com/en-us/library/aa384426(VS.85).aspx. It includes facilities for ecryption and authentication, as you'd expect.

PowerShell v2 远程处理基于Windows 远程管理。请参阅http://msdn.microsoft.com/en-us/library/aa384426(VS.85).aspx。正如您所期望的,它包括用于ecryption 和 authentication 的工具

PowerShell includes cmdlets that let you do a lot of everyday tasks. Microsoft server applications (IIS, Exchange, etc.) either have or are building PowerShell cmdlets to administer them. PowerShell's WMI support is excellent, giving you a lot of machine administration power. PowerShell can talk to .NET directly, which lets you go further than built-in facilities when needed. And writing C# for PowerShell to call works out cleanly, too.

PowerShell 包含 cmdlet,可让您完成许多日常任务。Microsoft 服务器应用程序(IIS、Exchange 等)已经或正在构建 PowerShell cmdlet 来管理它们。PowerShell 的 WMI 支持非常出色,为您提供了大量的机器管理能力。PowerShell 可以直接与 .NET 通信,这让您可以在需要时比内置工具走得更远。并且为 PowerShell 编写 C# 来调用也很干净。

You asked for a command line interface, but don't think that you're restricted to the ancient and crufty Windows Console subsystem. PowerShell v2 includes a new GUI interactive shell / script editor, with colorization and debugging. It's sweet.

您要求使用命令行界面,但不要认为您仅限于古老而笨拙的 Windows 控制台子系统。PowerShell v2 包括一个新的 GUI 交互式 shell/脚本编辑器,具有着色和调试功能。好可爱。

回答by Maxim Veksler

You can also try http://sshwindows.sourceforge.net/

你也可以试试http://sshwindows.sourceforge.net/

I don't have personal experience with it but it looks promising.

我没有个人经验,但它看起来很有希望。

回答by Serge Wautier

Did you consider Google? (looks like you edited your question. You now no longer ask if the example tasks can be achieved using PowerShell)

你考虑过谷歌吗?(看起来您编辑了您的问题。您现在不再询问是否可以使用 PowerShell 完成示例任务)

Powershell snap-in for IIS 7

IIS 7 的 Powershell 管理单元

Restart-Service

重启服务

Group policies

组策略

etc...

等等...

回答by Karl Thorwald

Sorry for not answering your question. I was in a similar situation.

很抱歉没有回答你的问题。我处于类似的情况。

I gave up to do all tasks on the windows shell

我放弃了在 windows shell 上完成所有任务

Instead I do use the shell for some tasks, but I am also using rdesktop (through ssh) and I put icons for the most important gui admin tools on the windows quicklaunch.

相反,我确实将 shell 用于某些任务,但我也在使用 rdesktop(通过 ssh)并且我在 windows 快速启动上放置了最重要的 gui 管理工具的图标。

I gave up making windows feel like unix because it never will.

我放弃让 Windows 感觉像 unix,因为它永远不会。

回答by Gabriel Lupi

alternatively try to download and install eurysco to use the following features that is based on another logic...

或者尝试下载并安装 eurysco 以使用以下基于另一种逻辑的功能...

1.create a new virtual folder in IIS (from eurysco commandline to launch vbs or powershell script) 2.setup firewall ports (from eurysco commandline to launch netsh.exe advfirewall) 3.restart services (from eurysco service control) 4.change user policies (from eurysco system registry or commandline to launch powershell script) 5.start desktop applications (from eurysco commandline to launch powershell script)

1.在IIS中创建一个新的虚拟文件夹(从eurysco命令行启动vbs或powershell脚本) 2.设置防火墙端口(从eurysco命令行启动netsh.exe advfirewall) 3.重新启动服务(从eurysco服务控制) 4.更改用户策略(从eurysco 系统注册表或命令行启动powershell 脚本) 5.启动桌面应用程序(从eurysco 命令行启动powershell 脚本)

http://www.eurysco.com/features

http://www.eurysco.com/features