Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 197835

Re: script to verify networking and storage?

$
0
0

So for networking you basically want to count the number of pNICs and their connection state, save that info and verify the state after the intervention ?

And for the LUNs you want to verify the available LUNs with their CanonicalName ?

 

In that case the following would be a rather simplistic implementation.

The script you run before the maintenance

 

Get-VMHost|%New-ObjectPSObject-Property@{    Name=$_.Name
   
pNICOnline=$_.ExtensionData.Config.Network.Pnic|      where {$_.LinkSpeed} |Measure-Object|Select-ExpandPropertyCount
   
NumberOfLUN=$_.ExtensionData.Config.StorageDevice.ScsiLun|
      where {$_.DeviceType-eq"disk"} |Measure-Object|Select-ExpandPropertyCount  } } |Export-CsvC:\esx-status.csv-NoTypeInformation-UseCulture

 

And after the maintenance you do the comparison with this script

 

Import-CsvC:\esx-status.csv-UseCulture|%$esx=Get-VMHost-Name$_.Name
 
$pNICOnline=$esx.ExtensionData.Config.Network.Pnic|    where {$_.LinkSpeed} |Measure-Object|Select-ExpandPropertyCount
 
$NumberOfLUN=$esx.ExtensionData.Config.StorageDevice.ScsiLun|
   
where {$_.DeviceType-eq"disk"} |Measure-Object|Select-ExpandPropertyCount
  if($pNICOnline-ne$_.pNICOnline){    Write-Host"$esx.Name - pNIC problem - Before $($_.PNICOnline) - After : $($pNICOnline)"
  } 
if($NumberOfLUN-ne$_.NumberOfLUN){    Write-Host"$esx.Name - LUN problem - Before $($_.NumberOfLUN) - After : $($NumberOfLUN)"
  } }

 

Host profiles might be an option for the network part, for the LUN part I don't see how that could be done easily.


Viewing all articles
Browse latest Browse all 197835

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>