zeejaved2023
Contributor
Contributor

VMware PowerCli Automation | Get-ChildItem | Get-VM

I have this script of power cli getting the required results of vmware.log file last modified time to know the last VM used date & time. 

Script:

$dsName = 'datastore1 (1.105)'
$ds = Get-Datastore -Name $dsName

New-PSDrive -Location $ds -Name DS -PSProvider VimDatastore -Root '\' | Out-Null

Get-ChildItem -Path "DS:" -Filter vmware.log -Recurse | select -Property DatastoreFullPath,LastWriteTime | Export-Csv D:\Result1.csv -NoTypeInformation

Remove-PSDrive -Name DS -Confirm:$false

 

My Requirement: 

Please help me out to get VM name also, I want to get also VMs detalis such as VM full name, Specs etc using Get-VM, any way to get results Get-VM and Get-ChildItem results combine and  export in single CSV file such as VM name and details and respectively get vmware.log last modified date from internal data store as working in the above mentioned script. 

0 Kudos
2 Replies
scott28tt
VMware Employee
VMware Employee

As your post needs moving to the area for PowerCLI, I have reported it to the volunteer moderators.

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
LucD
Leadership
Leadership

Duplicate of Solved: Re: VM last Modified date - VMware Technology Network VMTN

Please don't cross-post


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

0 Kudos