Hey all, hopefully your knowledge can help me out!
I added a custom plugin for our nightly vCheck report that lists all VMs that currently have RDMs attached as well as the LUN Name. I made sure to enable it via the "Select-Plugins.ps1" script.
When I run the vCheck manually by executing it everything seems to run just fine and it comes through in the emailed report formatted correctly (Mind you I only activate about half of the plugins to save on time when testing it). At night, however, when the scheduled task for vCheck runs it does not seem to include the report/table in the email even though it lists the plugin as enabled (see pic).
I checked permissions for the script file and it matches up with all of the other ones, so I wouldn't think it is a permission issue on the Windows side.
Below is the code itself in case that helps. I left out the header, title, comments, etc from this post but they are filled out correctly. A majority of the code came from this site as well and works fine manually.
$vms = $VM | Get-View
$rdmVMs = @()
foreach($machine in $vms){
foreach($dev in $machine.Config.Hardware.Device){
if(($dev.gettype()).Name -eq "VirtualDisk"){
if(($dev.Backing.CompatibilityMode -eq "physicalMode") -or
($dev.Backing.CompatibilityMode -eq "virtualMode")){
$row = "" | select VMName, VMHost, LUNName
$row.VMName = $machine.Name
$esx = Get-View $machine.Runtime.Host
$row.VMHost = ($esx).Name
$row.LUNName = ($esx.Config.StorageDevice.ScsiLun | where {$_.Uuid -eq $dev.Backing.LunUuid}).DisplayName
$rdmVMs += @($row | Select-Object -Property VMName, LUNName, VMHost)
}
}
}
}
$rdmVMs
Thanks a lot,
Andru