Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, May 31, 2018 4:17 AM
Hello
I know my questions and code are basic, but I will appreciate if help me. I have a code here for exporting servers ILO health summary:
$OutPut=@()
Get-Content .\ILO-IP.txt | ForEach-Object {
Get-HPiLOHealthSummary -server $_ -Username User -Password Pass -DisableCertificateAuthentication
$OutPut+= $_
}
$OutPut > c:\res.txt
and the result is like this:
WARNING: DNS name translation not available for 10.0.x.y. The hostname was not found.
IP : 10.0.x.z
HOSTNAME :
STATUS_TYPE : OK
STATUS_MESSAGE : OK
BATTERY_STATUS : OK
BIOS_HARDWARE_STATUS : OK
FANS_STATUS : OK
MEMORY_STATUS : OK
NETWORK_STATUS : OK
PROCESSOR_STATUS : OK
STORAGE_STATUS : OK
TEMPERATURE_STATUS : OK
WARNING: DNS name translation not available for 10.0.87.165. The hostname was not found.
IP : 10.0.x.y
HOSTNAME :
STATUS_TYPE : OK
STATUS_MESSAGE : OK
BATTERY_STATUS : OK
BIOS_HARDWARE_STATUS : OK
FANS : {@{STATUS=OK}, @{REDUNDANCY=Redundant}}
MEMORY_STATUS : OK
NETWORK_STATUS : Degraded
POWER_SUPPLIES : {@{STATUS=OK}, @{REDUNDANCY=Redundant}}
PROCESSOR_STATUS : OK
STORAGE_STATUS : OK
TEMPERATURE_STATUS : OK
My questions:
1- How can I access the results parts , like I need to show every thing but "OK" with red color in powershell console? the problem is not showing by red color, I need to filter "OK".
2- how can I eliminate DNS warning in output?
3- how to select output parameters to show all except hostname?
Thanks in advance.
All replies (7)
Thursday, May 31, 2018 5:08 AM | 1 vote
PowerShell does not allow for color text. Windows text files cannot have colors.
The warning message is due to the behavior of the ILO CmdLet. You can use the preference variable to disable warning messages.
To select custom output use the "Select-Object" CmdLet.
Mostly you need to learn PowerShell.
Follow the below instructions.
Please carefully review the following links to set your expectation for posting in technical forums.
This Forum is for Scripting Question Rather than script requests
Script requests
PowerShell Documentation
Smmary of useful forum links:
- Posting guidelines
- Handy tips for posting to this forum
- How to ask questions in a technical forum
- Rubber duck problem solving
- How to write a bad forum post
- Help Vampires: A Spotter's Guide
- This forum is for scripting questions rather than script requests
\(ツ)_/
Thursday, May 31, 2018 6:28 AM
If I have interests or time to learn powershell I wouldnt ask here, I need a quick code once in my job. please keep your advices for yourself (every time I ask a question you say this).
If you don't know the answer or don't have time ,just dont reply! that simple. I know you are moderator but keep calm and let other people answer.
my questions are clear and experts will answer.
thanks
Thursday, May 31, 2018 1:59 PM | 1 vote
This forum is not for free script writing or repair. If you don't have time to learn PowerShell then you will have to hire a consultant to helpyou.
For vendor specific issues you will have to post in the vendors support forums for help.
The above inks will help you to learn basic PowerShell.
I answered your questions as asked and pointed you towards learning how to find more information.
Please read the following. http://slash7.com/2006/12/22/vampires/
\(ツ)_/
Thursday, May 31, 2018 7:00 PM
It looks like your input file contains IP address and not names.
Are there PTR records in your DNS for those IP addresses? Can you resolve the IP addresses using nslookup?
Does the Get-HPiLOHealthSummary make any provisions for using IP addresses instead of names?
How you proceed from here depends on the answers to those questions.
Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)
Thursday, May 31, 2018 7:18 PM | 1 vote
The cause of name translation failure is do to running the ILO on n isolated network. We normally do this to prevent exposure of the ILO management net. The net has no DNS servers and the ILO normally has no name resolution.
This is optional and a simple DNS can be defined for an isolated management net.
If the ILO is run on the corporate net it will normally be configured to not register with DNS. Tis to can be changed.
The main issue is that the OP has no scripting experience or knowledge and is asking a shopping list of questions that learning PowerShell would answer.
Most of the OP's questions were addressed in my fist post.
The output on the screen is caused by all output not coming from the variable but coming from direct output. The Warning messages will not end up in the file. This is basic PowerShell.
If the code were written correctly the file would contain only the output and no warnings.
Taking the time to learn the basics would make all of this clear. Learn PowerShell
Get-Content .\ILO-IP.txt |
ForEach-Object {
Get-HPiLOHealthSummary -server $_ -Username User -Password Pass -DisableCertificateAuthentication -WarningAction SilentlyContinue
} |
Out-File c:\res.txt
You cannot learn PowerShell by guessing or asking questions. It must be studied like any other sophisticated technology.
\(ツ)_/
Thursday, May 31, 2018 7:24 PM | 1 vote
Also note that some basic information can be found with a search engine.
Here is what happens when we type the following in a search engine:
powershell warning <click to see results>
Learning a technology, science orr mathematics is an empirical process. It must be done in the order from basic to complex. Each layer build on the previous layer. You cannot guess at how this structure is built. It must be studied.
\(ツ)_/
Saturday, June 2, 2018 11:07 AM
Yes dear I found out we can't define reverse lookup in DNS for ILO names. so I used "| Select-Object -ExcludeProperty HOSTNAME"
hostname issues are resolved now.