Quantcast
Channel: VMware Communities : Popular Discussions - vCloud Director PowerCLI
Viewing all articles
Browse latest Browse all 13334

Display and remove snapshots from vCloud Director 5.1

$
0
0

Hi All,

 

I've been trying without success to create a PowerCLI script that will report back and delete all snapshot over x days.

 

If I run the vSphere 5.5 PowerCLI commands:

 

Get-VM | Get-Snapshot | Where { $_.Created -lt (Get-Date).AddDays(-15)}

 

I get a list of snapshots that are over 15 days (for example).

My understanding is that if use this script as the basis for the 'Remove-Snapshot', it will 'break' vCloud Director so that is off the cards.

 

As there doesn't seem to be any native PowerCLI commands to deal with snapshots in vCloud Director 5.1, I altered the command above with help from the module from GeekAfterFive - Infrastructure as Code (I'm told that the API hasn't changed from 1.5 to 5.1)

If I rerun the command as such:


Get-CIVM | Get-CISnapshot | Where { $_.Created -lt (Get-Date).AddDays(-15)}

I get the error message:

+ $streamReader = new-object System.IO.StreamReader($response.getResponseStream <<<< ())

+ CategoryInfo          : InvalidOperation: (getResponseStream:String) [],    RuntimeException

+ FullyQualifiedErrorId : InvokeMethodOnNull

 

 

You cannot call a method on a null-valued expression.

Any help would be greatly appreciated!

 

Chris


Viewing all articles
Browse latest Browse all 13334

Trending Articles



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