首页 / 更多教程 / PowerShell代码再次测试
PowerShell代码再次测试
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了PowerShell代码再次测试,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2607字,纯文字阅读大概需要4分钟。
内容图文
![PowerShell代码再次测试](/upload/InfoBanner/zyjiaocheng/1295/17fa597ae8494c1ab78925867aabadd8.jpg)
![技术分享](/upload/getfiles/default/2022/11/8/20221108010714802.jpg)
![技术分享](/upload/getfiles/default/2022/11/8/20221108010714890.jpg)
1 # Requires -Version 3.0 -Modules @{ModuleName=‘HPiLOCmdlets‘;ModuleVersion=‘1.2.0.0‘} 2 # ============================================================================================= 3 # Example script for reading HPiLO settings. 4 # Only iLO 3 and higher is supported. 5 6 # AUTHOR thomas.franke@sepago.de / sepago GmbH 7 # German Blog http://www.powercli.de 8 # English Blog http://www.thomas-franke.net 9 # LASTEDIT 15.10.2015 10 # ============================================================================================= 11 Set-StrictMode -Version Latest 12 Clear-Host 1314 Push-Location $(Split-Path $Script:MyInvocation.MyCommand.Path) 1516 . .\include\Get-PSCredential.ps1 1718# Create/read user credentials from file19$UserName = "<UserName>"20$PSCredential = Get-PSCredential $UserName2122# A higher timeout improves the detection rate if iLO is connected will less than 1 GBit/s. 23# Default is 300 milliseconds24# 25$TimeOut = 1000 2627# The IPRange is read from a file which must contain a single IP address per row. 28# You can use Discover-HPiLO.ps1 to generate the file or create it manually. 29# 30$InputFileName = "Discovered-HPiLOs.txt"31$IPRange = Get-Content $InputFileName3233 Write-Output "Discovering iLO boards...`n"34ForEach($IPAddressin$IPRange) 35{ 36$IsOnline = Find-HPiLO $IPAddress -Timeout $TimeOut37If ($IsOnline) 38 { 39$Output = "[online] $IPAddress`t" + $IsOnline.Hostname 40$ForegroundColor = "Green"41 Write-Host $Output -ForegroundColor $ForegroundColor4243If (($IsOnline.PN -eq"Integrated Lights-Out 4 (iLO 4)") -Or ($IsOnline.PN -eq"Integrated Lights-Out 3 (iLO 3)")) 44 { 45$Output = "`n[$($IsOnline.PN)] detected`n"46$ForegroundColor = "Green"47 Write-Host $Output -ForegroundColor $ForegroundColor4849 Write-Output "Reading data from iLO $($IsOnline.HostName) [$($IsOnline.IP)]`n"5051# Change the following HPiLO cmdlet to read other data from the iLO board52# Modify or delete the Select-statement to get more properties53$HPiLOData = Get-HPiLOSNMPIMSetting -Server $IPAddress -Credential $PSCredential | Select-Object -Property IP,HOSTNAME,STATUS_MESSAGE,SNMP_ADDRESS_1 54 Write-Output $HPiLOData"`n"55 } 56Else57 { 58$Output = "`n[$($IsOnline.PN)] detected, which is not supported!`n"59$ForegroundColor = "Red"60 Write-Host $Output -ForegroundColor $ForegroundColor61 } 62 } 63Else64 { 65$Output = "[offline] $IPAddress`n"66$ForegroundColor = "Red"67 Write-Host $Output -ForegroundColor $ForegroundColor68 } 6970 Write-Output "---`n"71} 7273 Pop-Location
原文:http://www.cnblogs.com/hinkerliu/p/5751392.html
内容总结
以上是互联网集市为您收集整理的PowerShell代码再次测试全部内容,希望文章能够帮你解决PowerShell代码再次测试所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。