Powershell与运维之服务器管理(二) 利用Powershell管理Dell服务器
Powershell与运维之服务器管理(二) 利用Powershell管理Dell服务器
相比较HP ILO和OA来说,Poweshell对Dell的iDRAC管理没有这么简单,Dell没有相对于HP的管理模块。目前主要是通过Powershell3.0出现的CIM Session是来实现管理的。
因为我的环境Dell服务器没有连接管理卡,就借助一个×××贴的例子来说明:
1用变量来存储管理卡的IP用户名和密码:
$UserName="root"
$Password="calvin"
$DracIP="10.10.0.120"1.2.3.4.
2 转换用户名和密码
$SecurePass = ConvertTo-SecureString $Password -AsPlainText -Force
$DracCred = new-object -typename System.Management.Automation.PSCredential -argumentlist $UserName,$SecurePass1.2.
3 建立一条到管理卡的CIMSession
$cimop=New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 –UseSsl
$Dracsession=New-CimSession -Authentication Basic -Credential $DracCred -ComputerName $DracIP -Port 443 -SessionOption $cimop -OperationTimeoutSec 100000001.2.
4 建立Session后我们可以使用Get-Ciminstance通过传递Wsman/winrm的ResourceURI查询各种属性。
登录后复制
Get-CimInstance -CimSession $Dracsession -ResourceUri "
http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_SystemView
"1.2.3.
来自51CTO博客作者handsome7038的原创作品,如需转载,请注明出处,否则将追究法律责任
https://blog.51cto.com/lixiaosong/1542611