alanrenouf / vCheck-vSphere

vCheck Daily Report for vSphere
MIT License
735 stars 325 forks source link

Snapshot creator is not shown #248

Open Mike-J-Leone opened 10 years ago

Mike-J-Leone commented 10 years ago

When the snapshot plugin runs, I get all information except creator name; that column is always blank.(ideally, I would like vCheck to optionally also email the snapshot creator as a reminder, but I realize that's a separate script). But I would like to at least see the vCenter login of the user who created the script (if it was an AD account, seeing the real name of the user would be great, but even just the login would help).

This is vCheck v6.20-alpha-1 , I downloaded it about 2 weeks ago (2014-08-19).

Mike-J-Leone commented 10 years ago

Here's what I have found so far:

In the function "Get-SnapshotExtra", there is a test for "$report.ContainsKey($key)". This always seems to come out false for me. If I change the section to:

    if($report.ContainsKey($key)){
        $_ | Add-Member -MemberType NoteProperty -Name Creator -Value $report[$key].User
    } ELSE {
        $_ | Add-Member -MemberType NoteProperty -Name Creator -Value "Blank User Name"
    }

Then all my snapshots have a creator value of "Blank User Name". IOW, that if always fails, so there is never a creator name listed.

Sneddo commented 10 years ago

Will need to look at this in a bit more detail.

Looks like possibly a bug on line 70: $filter.Time.beginTime = (($snap.Created).AddDays(-5))

This doesn't use the $SnapshotAge variable which may be causing this issue. Can you try replacing line 70 with the following: $filter.Time.beginTime = (($snap.Created).AddDays(-$SnapshotAge ))

ghost commented 9 years ago

Just curious if there has been any further movement on this. We are seeing this issue as well.

vScripter commented 9 years ago

Can those users who are encountering issues provide version details about your environment?

ghost commented 9 years ago

Sorry for the slow response: PowerCLI: 5.1 PowerShell: 4.0 vCenter: 5.5 OS: Windows 8.1

mrclschstr commented 6 years ago

Long story short: I experienced this issue within different environments and restructured the plugin fundamentally. It now uses the Get-VIEventPlus Cmdlet like in plugin "85 Snapshot Activity". You can find my restructured version here: https://github.com/mrclschstr/vCheck-vSphere/commit/78d99918752945aad3f3ed58fc5dd8cae813dbf3

Feel free to integrate this in your vChecks.

EDIT: Small update https://github.com/mrclschstr/vCheck-vSphere/commit/e8ed338679f2e5aaccc9a72020741637979a4dbe