Enthusiast
Enthusiast

Help with the script

Jump to solution

Dear All,

Greetings!

Am trying to get the following details but it is not getting any output in excel file, someone help me in correcting this.

Get-Cluster |select Name, DrsEnabled, @{N="Details" E={Get-VMHostHardware | select VMHost, Manufacturer, Model, SerialNumber,BIOSversion}} | export-csv     .\info.csv

output

Dataceneter Name, Cluster Name, DRSenabled, VMhost, Manufature, Model, Serialnumber, BIOSversion.

1 Solution

Accepted Solutions
Leadership
Leadership

The name of the property is not correct.
Try like this

Get-Datacenter -PipelineVariable ds|

Get-VMHost -PipelineVariable esx |

Get-VMHostHardware |

select @{N='Site';E={$ds.Name}},

   @{N='Cluster';E={$cluster.Name}},

   @{N='Total Servers in Cluster';E={$cluster.ExtensionData.Summary.numHosts}},

   @{N='VMHost';E={$esx.Name}},

   @{N='DrsEnabled';E={$cluster.DrsEnabled}},

  Manufacturer, Model, SerialNumber,BIOSversion |

Export-Csv -Path .\info.csv -NoTypeInformation -UseCulture

I have no experience with this HP Portal. But if it can be queried with a script, you should be able to add this.
Can you show how you script such a query?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

5 Replies
Leadership
Leadership

Try like this

Get-Cluster -PipelineVariable cluster |

Get-VMHost -PipelineVariable esx |

Get-VMHostHardware |

select @{N='Cluster';E={$cluster.Name}}

   @{N='VMHost';E={$esx.Name}},

   @{N='DrsEnabled';E={$cluster.DrsEnabled}},

  Manufacturer, Model, SerialNumber,BIOSversion |

Export-Csv -Path .\info.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Enthusiast
Enthusiast

Yes! it is working.

I just added Datacenter details which was not listed in the out put., am looking to get the count of the server is in each cluster which is not working whith the following exentsiondate.

and is there any possibility to check the server warranty status by connecting to the HP portal through the script?

Get-Datacenter -PipelineVariable ds|

Get-Cluster -PipelineVariable cluster |

Get-VMHost -PipelineVariable esx |

Get-VMHostHardware |

select @{N='Site';E={$ds.Name}},@{N='Cluster';E={$cluster.Name}},

   @{N='VMHost';E={$esx.Name}},

   @{N='DrsEnabled';E={$cluster.DrsEnabled}},  Manufacturer, Model, SerialNumber,BIOSversion, @{N='Total Servers in Cluster';E={$cluster.extendata.summary.numberofhosts}, |

Export-Csv -Path c:\iinfo.csv -NoTypeInformation -UseCulture

0 Kudos
Leadership
Leadership

The name of the property is not correct.
Try like this

Get-Datacenter -PipelineVariable ds|

Get-VMHost -PipelineVariable esx |

Get-VMHostHardware |

select @{N='Site';E={$ds.Name}},

   @{N='Cluster';E={$cluster.Name}},

   @{N='Total Servers in Cluster';E={$cluster.ExtensionData.Summary.numHosts}},

   @{N='VMHost';E={$esx.Name}},

   @{N='DrsEnabled';E={$cluster.DrsEnabled}},

  Manufacturer, Model, SerialNumber,BIOSversion |

Export-Csv -Path .\info.csv -NoTypeInformation -UseCulture

I have no experience with this HP Portal. But if it can be queried with a script, you should be able to add this.
Can you show how you script such a query?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Enthusiast
Enthusiast

oh, yeah property was incorrect. thank you Lucd for correcting.

I found a script to check hp servers warranty

HP Product Warranty Bulk Checker PowerShell Script

0 Kudos
Leadership
Leadership

Since warranty is something that does not change, or at least not frequently, I would suggest to run that script and create the CSV file.

Do that in a separate script, and use the produced CSV as a kind of lookup table in the code above.

I don't know how the content of that CSV looks like, so I don't what property you could use to do the lookup.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos