I suspect something might have gone wrong with the copy/paste and some <CR><LF> were dropped.
Try with this
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
But you only seem to go back 10 days for the events, while you look for events older than 30 days.
That doesn't sound right.