Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 232869

Re: Who Built the vm

$
0
0

Hey LucD,

 

I tried the Events-4 with the vm created event.

 

 

Get-VIEvent -Start (Get-Date).adddays(-10) | `
  where {$_.gettype().Name -eq "VmCreatedEvent" -and $_.CreatedTime -lt (Get-Date).adddays(-30)} | `  select @{N="VMname"; E={$_.Vm.Name}},
    @{N="CreatedTime"; E={$_.CreatedTime}},
    @{N="Host"; E={$_.Host.Name}},
    @{N="User"; E={$_.UserName}} | `
  Export-Csv "C:\VM-vmcreatedevent-audit.csv" -NoTypeInformation -UseCulture

 

 

I had the following error

 

 

The term ' ' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, v

rify that the path is correct and try again.

At line:2 char:102

+   where {$_.gettype().Name -eq "VmCreatedEvent" -and $_.CreatedTime -lt (Get-Date).adddays(-30)} | `  <<<<  select @{N="VMname"; E={$_.Vm.Name}},

    + CategoryInfo          : ObjectNotFound: ( :String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

 

I ahve taken away the ' before select and it executed without errors but in the csv file is blank. i didnt have the header names also.

 

Thanks

VK


Viewing all articles
Browse latest Browse all 232869

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>