Powershell Windows Eventlog script

This week i found the report-events Powershell script (see figure 1). The script is made by Jeffrey Hicks. It generates a nice HTML file with errors and warnings from the Windows eventlog.

image

figure 1. Output reports-event script

You can specify multiple servers in a text file, select how many hours from the current time to look in the eventlog and e-mail the HTML file after generation. 

The following syntax can be used:

get-content c:\script\servers.txt | c:\scripts\report-event.ps1 – report c:\script\eventlog.html –hours 48 –smtp mail.beerenss.nl –sendto eventlogs@beerens.nl –from eventlog@beerens.nl

Explanation:

get-content c:\script\servers.txt, text file containing the server names

– report c:\script\eventlog.html, name of the HTML file

| c:\scripts\report-event.ps1, call the actually script

–hours 48, hours to report from the curren time

–smtp mail.beerens.nl. SMTP server to sent the HTML rapport 

–sendto ivo@beerens.nl, To address

–from eventlog@beerens.nl . from address

 

Schedule this script to run frequently to watch your eventlogs!

 

Download the script here.

 [ad#verticaal]

Missing datastore (LUN), EnableResignature

 

Yesterday a customer called me that one of the VMware ESX hosts is missing 1 datastore (LUN). The other VMware ESX hosts in the cluster had no problems with the datastore. Looked in the NetApp filer to see the presentation of the LUN, everything was okay.

After investing the log files on the VMware ESX host i found the following message:

Jan 22 12:39:34 boz101 vmkernel: 152:21:01:58.702 cpu4:1040)ALERT: LVM: 4476: vml.020003000060a980004335434b464a4b77554e59744c554e202020:1 may be snapshot: disabling access. See resignaturing section in SAN config guide.

It seems that the VMFS volume has been detected with a different LUN ID. The LUN ID is stored in the LVM header of the volume. When the LUN ID changes you need to enable resignature option to see the datastore again.

In the evening we powered all VMs on that LUN down.  On the host that was missing the datastore, I enabled the resignaturing option by:

– Go to the configuration tab of the VMware ESX host and select Advanced settings

– Click on LVM, and changed  the EnableResignature  0 (off) in 1 (on).

Did a rescan on the VMware ESX host and the LUN appeared as “SNAP-17EABCCC-VMWARE-LUN-03”. Tried the change the “SNAP-17EABCCC-VMWARE-LUN-03” LUN back to the old name “VMWARE-LUN-03”,  the following message appeared:

The name “VMWARE-LUN-03” already exists.

The solution was to switch the view to DATASTORES in vCenter and unregister all VMs on the “SNAP-17EABCCC-VMWARE-LUN-03” LUN. After all VMs were unregistered, i was able to rename it back to  the old “VMWARE-LUN-03” name. Then i register all the VMs on the “VMWARE-LUN-03” LUN and start them.

I checked the datastores on the other VMware ESX hosts,  they were fine. As last step i changed the EnableResignature option back to 0 (off) on the VMware ESX host.

 [ad#verticaal]

 

New version of the Powershell Healthcheck script released

Version 2.0 of the Healthcheck script is released. The script reports the following:

– VMware ESX server Hardware and version         
– VMware vCenter version    
– Cluster information (Updated)    
– VMware statistics (New)
– Active Snapshots    
– CDROMs connected to VMs   
– Floppy drives connected to VMs  
– Datastores Information such as free space
– RDM information  (New)
– VM information such as VMware tools version,  processor and memory limits     
– VM’s and there datastore (New)
– VMware timesync enabled  
– Percentage disk space used inside the VM (New)    
– VC error logs last 5 days (New)

It is possible to schedule this script and output the content to HTML and e-mail it. 

I uses some of enhancements from the VI Toolkit forum @

http://communities.vmware.com/community/developer/windows_toolkit

If you have suggestions , let me know!

You can download the script here.

 image

[ad#verticaal]