VMware Cloud Community
alanrenouf
VMware Employee
VMware Employee
Jump to solution

Who created the Snapshot

Any idea how I can relatemy Get-Snapshot information to the Get-VIEvent information to work out who created a snapshot ?

Thanks

Alan

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Tags (1)
0 Kudos
76 Replies
LucD
Leadership
Leadership
Jump to solution

Ok, in the following replace my accountname with yours (only the account, not the domain).

Then check if the mail address is returned.

$usr = 'lucd'

$root = [ADSI]""

$filter = ("(&(objectCategory=user)(samAccountName=$Usr))")

$ds = New-Object system.DirectoryServices.DirectorySearcher($root,$filter)

$ds.PageSize = 1000

$info = $ds.FindOne()

$info | Select @{N='User';E={$_.Properties.name}},@{N='Mail';E={$_.Properties.mail}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
dlgaines
Contributor
Contributor
Jump to solution

It looks like you're referencing lines 12-17. Do I also need to add this line?

$info | Select @{N='User';E={$_.Properties.name}},@{N='Mail';E={$_.Properties.mail}}

And then replace line 17 with this line?

$info = $ds.FindOne()

Edit: After running it with just changing the username name I still have a empty value in the mailto variable.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

No, no, this is a stand-alone script to check if your email address is returned correctly from the AD search


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
dlgaines
Contributor
Contributor
Jump to solution

That script returned "Exception calling "FindOne" with "0" argument(s): "The specified domain either does not exist or could not be contacted."

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Does this return your AD domain?

([ADSI]"").distinguishedName


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
dlgaines
Contributor
Contributor
Jump to solution

It ran but did not return anything.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you logon to an AD domain?
Or are you working form a stand-alone station?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
dlgaines
Contributor
Contributor
Jump to solution

I logon to an AD domain.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Does this make a difference?

$usr = 'lucd'

$filter = ("(&(objectCategory=user)(samAccountName=$Usr))")

$ds = New-Object system.DirectoryServices.DirectorySearcher($filter)

$ds.PageSize = 1000

$info = $ds.FindOne()

$info | Select @{N='User';E={$_.Properties.name}},@{N='Mail';E={$_.Properties.mail}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
dlgaines
Contributor
Contributor
Jump to solution

I get the same error as before.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I'm afraid I'm at my wit's end for now.

The issue with the missing email is obviously due to the fact that the email address can't be obtained from AD.

Not sure why right now.

Do your AD admins perhaps have some code that is able to retrieve user info from AD


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
dlgaines
Contributor
Contributor
Jump to solution

I really appreciate your time spent helping me. I can ask to see if that would be possible to do. I'll update if I can get it working.

0 Kudos
afhamsani
Enthusiast
Enthusiast
Jump to solution

LucD​ is it possible using this to look for snapshot creator that was 2-3 months back?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Depends how long Task and Events are kept in your vCenter.

The default is 1 year, in that case, yes, you should be able to find the creator.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
afhamsani
Enthusiast
Enthusiast
Jump to solution

LudD, is there any where to tweak this?

i found out my environment might be holding shorter timespan as i could not get a creator of snapshot although the script able to list any VMs which has snapshot.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I'm afraid not, afaik.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
afhamsani
Enthusiast
Enthusiast
Jump to solution

the thing it is able to get the vm snapshot creation details except creator makes me wonder, why.

if you found anywhere, please give a shout

thanks

0 Kudos