Wednesday, April 10, 2013

Add Notes / Description

Following one liner can be used to add notes to a virtual guest.

Get-VM "Server Name"  | Set-VM -Notes "Description" 

Please use this on your own risk. This command will over-write the Description .

To add notes to multiple VMs 

Import-Csv "c:\Temp\vmlist.csv" | %{Set-VM  $_.VMName -Notes $_.Note -Confirm:$false}

The CSV should have vmname and the relevant notes.

Wednesday, April 3, 2013

Event Log Monitoring

Following script can be used to pull the report which has all the errors reported from start date to end date.

get-vievent -MaxSamples 3 -Start 03/01/2013 -Finish 04/03/2013 -Types error | Select CreatedTime , UserName , FullFormattedMessage | Export-Csv c:\Temp\error.csv