PowerShell script exchange
Post Reply
spgsit5upport
Expert
Posts: 221
Liked: 16 times
Joined: May 28, 2010 10:25 am
Full Name: Seb
Contact:

Reset-HvVmChangeTracking cmdlet - remove ALL

Post by spgsit5upport »

As this cmdlet does not accept wildcard *, does anybody have a script that does resets tracking for ALL VMs on any given host?

Thanks

Seb
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Reset-HvVmChangeTracking cmdlet - remove ALL

Post by veremin »

May be something like this will answer your requirements?

Code: Select all

foreach ($Server in (Get-VBRServer | where {$_.Type -eq "HvServer"}))
{
Reset-HvVmChangeTracking -Server $Server
}
Thanks.
spgsit5upport
Expert
Posts: 221
Liked: 16 times
Joined: May 28, 2010 10:25 am
Full Name: Seb
Contact:

Re: Reset-HvVmChangeTracking cmdlet - remove ALL

Post by spgsit5upport »

But Reset-HvVmChangeTracking also requires -VMName parameter (which can not be * )
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Reset-HvVmChangeTracking cmdlet - remove ALL

Post by veremin »

Then, additional loop is required; give a shot to the following example (unfortunately, can't test it myself at the moment):

Code: Select all

foreach ($Server in (Get-VBRServer | where {$_.Type -eq "HvServer"}))
{
foreach ($VM in (Find-VBRHvEntity -Server $Server | where {$_.Type -eq "VM"}))
{
Reset-HvVmChangeTracking -Server $Server -VMname $VM.name
}
}
Thanks.
spgsit5upport
Expert
Posts: 221
Liked: 16 times
Joined: May 28, 2010 10:25 am
Full Name: Seb
Contact:

Re: Reset-HvVmChangeTracking cmdlet - remove ALL

Post by spgsit5upport »

Perfect, thanks

Seb
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Reset-HvVmChangeTracking cmdlet - remove ALL

Post by veremin »

You're welcome. Let me know, if you need other assistance with scripting. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests