VMware Cloud Community
oscarjrodriguez
Contributor
Contributor

Requesting help - with decommission script

I've tried a few sites, and onyx, but no luck so far. Thank you for any help.

I am attempting the following large goal:

create a script that:

1.adds the following to a target vm's name "decomm"

2.Then creates a task to power down the VM after 7 days.

3. Delete the VM from disk after 14 days.

 

I only have  basic script at this point.

 

 

$serverlist = Get-Content path

foreach ($vm in $serverlist)

{

Get-VM $vm | Stop-VM -kill $vm -confirm:$false

 

}

Reply
0 Kudos
0 Replies