Posted in
Virtual Machine Manager,
Windows Powershell |
No Comment | 3,241 views | 12/12/2013 15:07
I use Custom1 section in SCVMM to set expiry date for virtual machines.
1
2
3
4
5
6
7
| $Date = (Get-Date).AddDays(180).ToString("U")
$cp1 = Get-SCCustomProperty -Name Custom1
$VMs = Get-VM
foreach ($VM in $VMs)
{
$VM | Set-SCCustomPropertyValue -CustomProperty $cp1 -Value $Date
} |
$Date = (Get-Date).AddDays(180).ToString("U")
$cp1 = Get-SCCustomProperty -Name Custom1
$VMs = Get-VM
foreach ($VM in $VMs)
{
$VM | Set-SCCustomPropertyValue -CustomProperty $cp1 -Value $Date
}
I use System Center Orchestrator to check expiry dates.