VMware Cloud Community
ajohn24
Contributor
Contributor
Jump to solution

list of vms created

Hi All,

I was trying to use the script “who created the VM” .

Unfortunately, all its shows is CreatedBy “unknown” and CreatedOn "Unknown" except for a bunch of machines.

I have the guest AD commandlets installed and running. But all it shows is unknown. Any ideas/suggestions?

Thanks,

A

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Yes, use the -MaxSamples parameter.

Get-VIEvent -MaxSamples 1000

or use the -Start and -Finish parameters to specify a specific time range (watch out, the cmdlet becomes a lot slower with a time range specified).

The Created On works for me, are you using the script from the Who created that VM ? post ?

____________

Blog: LucD notes

Twitter: lucd22


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

View solution in original post

0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

Alan's script uses the Get-VIEvent cmdlet to find the entry for the creation of a guest.

By default the cmdlet returns 100 most recent events.

If your guests haven't been created recently, the VmCreatedEvent will not be found and the script will mark the user as 'Unknown'.

To test, make a new guest and run the script again.

For that recent guest you should see the custom attrbutes appear.

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
ajohn24
Contributor
Contributor
Jump to solution

Agreed and absolutely understandable.

As a query, is there any commandlet that can dig further deeper to look out for say, 1000 events or more. Also its not true for the case of "CreatedOn" . As the machine that shows "CreatedBy" - "username" still shows "CreatedOn" as unknown.

Thanks again for your comments.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, use the -MaxSamples parameter.

Get-VIEvent -MaxSamples 1000

or use the -Start and -Finish parameters to specify a specific time range (watch out, the cmdlet becomes a lot slower with a time range specified).

The Created On works for me, are you using the script from the Who created that VM ? post ?

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
ajohn24
Contributor
Contributor
Jump to solution

Adding max samples works like a charm. Can you guide me to a documentation for learning about these events and in depth stuff for power shell.

Thanks and Regards

A

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I have some posts on events.

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos