Formula una domandaFormula una domanda
 

Con rispostaScript to Turn Off all Hyper-V VMs?

Risposte

  • giovedì 30 ottobre 2008 19.04tonyso Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Con rispostaContiene codice
    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
    • Modificatotonyso giovedì 30 ottobre 2008 19.04has code
    • Contrassegnato come rispostatonyso giovedì 30 ottobre 2008 19.04
    •  

Tutte le risposte

  • giovedì 30 ottobre 2008 19.04tonyso Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Con rispostaContiene codice
    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
    • Modificatotonyso giovedì 30 ottobre 2008 19.04has code
    • Contrassegnato come rispostatonyso giovedì 30 ottobre 2008 19.04
    •  
  • lunedì 24 novembre 2008 13.26DungKHoang Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
     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