Hi,
for my daily report I want to execute the following script
$server = Get-VIServer -Server
echo "VMs with CDROMs connected:"
echo "============================"
Get-VM | where { $_ | get-cddrive | where { $_.ConnectionState.Connected -eq "true" } } | select Name,powerState
echo ""
echo "VMs with existing snapshots:"
echo "============================"
Get-VM | Get-Snapshot | select { $_.vm.name },{ $_.vm.powerState },name,created
echo ""
echo "VMs with existing snapshots older than 3 Months:"
echo "============================"
Get-VM | Get-Snapshot | where {$_.created -lt ((get-Date).addMonths(-3))} | select { $_.vm.name },{ $_.vm.powerState },name,created
When I execute each block separately it works fine but running it in conjunction the last two blocks (existing snaps and snaps older than three months) will output only the name of the snap.
Any idea where this may result from?