天天看点

利用Powershell SSH-Session 工具管理 linux或网络设备

首先我们需要下载这个工具

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620181HvlU.png" target="_blank"></a>

1 下载的文件内容,请注意针对你使用的powershell 版本下载相应的的版本,有支持powershell2.0以及支持powershell3.0和4.0。

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620182ZE8B.png" target="_blank"></a>

2检测一下你的系统 powershell模块放置的目录

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620182jTYX.png" target="_blank"></a>

3 所以将下载的压缩文件解压到这两个目录随意一个都可以:

C:\Users\lixs\Documents\WindowsPowerShell\Modules   

C:\Windows\system32\WindowsPowerShell\v1.0\Modules\

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620182ZIIE.png" target="_blank"></a>

文件夹里面的文件列表,这个DLL文件需要.net 3.5或以上版本支持。

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_14066201827FYV.png" target="_blank"></a>

4  下面就是介绍这个功能应该怎么使用,我们首先导入这个模块,当然你也可以将它直接写入配置文件以便启用powershell的时候直接调用:

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620182PN6r.png" target="_blank"></a>

我们要知道怎么使用这个命令当然需要查看一下帮助信息:

5 我们先获取一下这个功能带入了那些cmdlets

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620182nqiL.png" target="_blank"></a>

6 查看一下某个命令的帮助信息

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620182T9s7.png" target="_blank"></a>

可以通过摘要信息了解到此模块可以建立SSH会话到远程SSH兼容的主机。如:linux 或Unlix计算机或网络设备。

下面就举例说明一下怎么管理某个linux主机:

1 找到一个linux服务器,可以通过SecureCRT远程到。

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620182RQK5.png" target="_blank"></a>

2 建立一个到这个linux主机的Session(会话):

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620183QYDX.png" target="_blank"></a>

3 查看这个会话:

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_140662018348hS.png" target="_blank"></a>

4 看看我们建立完会话以后可以做哪些事呢?

查看IP

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620183YIsY.png" target="_blank"></a>

查看版本信息:

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620183Rs7i.png" target="_blank"></a>

登录这个会话调试信息:

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_14066201837dyz.png" target="_blank"></a>

5  删除会话:

<a href="http://lixiaosong.blog.51cto.com/attachment/201407/29/705126_1406620187UZXO.png" target="_blank"></a>

当然也可以管理网络设备,接下来会有相关的介绍,大家也可以尝试一下!

功能还是很强大啊哈哈!

本文转自handsome7038 51CTO博客,原文链接:http://blog.51cto.com/lixiaosong/1532280

继续阅读