次の方法で共有


How to change ownership of virtual machines via PowerShell with SCVMM 2008 R2

I recently spoke with a customer who owned roughly fifty virtual machines in his SCVMM environment and he needed to reassign ownership of all virtual machines to a teammate.  As you can imagine he was not interested in double clicking on all those virtual machines from the SCVMM console and change the owner property.  Is it possible to automate this task?
Leveraging the PowerShell Cmdlets provided by the VMM team this can be achieved with the following script.  Just replace the variables with the appropriate values for your environment.  This task will reset ownership of all virtual machines one at a time.

* Where "%Domain\1stUser% is the current owner and "%Domain\2ndUser% is the desired owner

Get-VM -VMMServer "%YourVMMServername%" | where {$_.Owner -eq "%Domain\1stUser%"} | Set-VM -Owner "%Domain\2ndUser%"

System Center Virtual Machine Manager 2008 R2 Cmdlet Reference

Dave Guenthner [MSFT]
This posting is provided "AS IS" with no warranties, and confers no rights.