提出问题提出问题
 

已答复Script to Turn Off all Hyper-V VMs?

答案

  • 2008年10月30日 19:04tonyso 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     已答复包含代码
    John Kelbley provides one, you can leave feedback here or contact johnkel@microsoft.com:

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\virtualization")
    Set vmcollecion = objWMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem",,48)

    ' loop through all instances in collection
    For each vm in vmcollecion
     RequestReturn = vm.RequestStateChange(3)
    Next



    Tony Soper
    • 已编辑tonyso 2008年10月30日 19:04has code
    • 已标记为答案tonyso 2008年10月30日 19:04
    •  

全部回复

  • 2008年10月30日 19:04tonyso 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     已答复包含代码
    John Kelbley provides one, you can leave feedback here or contact johnkel@microsoft.com:

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\virtualization")
    Set vmcollecion = objWMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem",,48)

    ' loop through all instances in collection
    For each vm in vmcollecion
     RequestReturn = vm.RequestStateChange(3)
    Next



    Tony Soper
    • 已编辑tonyso 2008年10月30日 19:04has code
    • 已标记为答案tonyso 2008年10月30日 19:04
    •  
  • 2008年11月24日 13:26DungKHoang 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
     You can also check my blog on Hyper-V  and PowerShell.
    I have some examples using PowerShell coding against WMI

    EnjoY!
    /Dung

    http://dungkhoang.spaces.live.com