Stellen Sie eine FrageStellen Sie eine Frage
 

BeantwortetScript to Start a VM?

Antworten

  • Donnerstag, 30. Oktober 2008 19:21tonysoperMSFTTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     BeantwortetEnthält Code
    John Kelbley has provided one. Leave feedback here or you can e-mail johnkel@microsoft.com/ 

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\virtualization")
    ' Obtain an instance of the the class
    ' using a key property value.


    "select * from Msvm_ComputerSystem where elementname ="  +"'" + $virtualguest + "'"


    Set objShare = objWMIService.Get("Msvm_ComputerSystem.CreationClassName='Msvm_ComputerSystem', ElementName='CCS V1 Head'")
    Set objInParam = objShare.Methods_("RequestStateChange").inParameters.SpawnInstance_()
    objInParam.Properties_.Item("RequestedState") =  2
    Set objOutParams = objWMIService.ExecMethod("Msvm_ComputerSystem.CreationClassName='Msvm_ComputerSystem', ElementName='CCS V1 Head'", "RequestStateChange", objInParam)


    tony soper
    • Als Antwort vorgeschlagentonysoperMSFTDonnerstag, 30. Oktober 2008 19:21
    • Als Antwort markierttonysoperMSFTDonnerstag, 30. Oktober 2008 19:21
    • Nicht als Antwort vorgeschlagentonysoperMSFTDonnerstag, 30. Oktober 2008 19:21
    •  

Alle Antworten

  • Donnerstag, 30. Oktober 2008 19:21tonysoperMSFTTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     BeantwortetEnthält Code
    John Kelbley has provided one. Leave feedback here or you can e-mail johnkel@microsoft.com/ 

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\virtualization")
    ' Obtain an instance of the the class
    ' using a key property value.


    "select * from Msvm_ComputerSystem where elementname ="  +"'" + $virtualguest + "'"


    Set objShare = objWMIService.Get("Msvm_ComputerSystem.CreationClassName='Msvm_ComputerSystem', ElementName='CCS V1 Head'")
    Set objInParam = objShare.Methods_("RequestStateChange").inParameters.SpawnInstance_()
    objInParam.Properties_.Item("RequestedState") =  2
    Set objOutParams = objWMIService.ExecMethod("Msvm_ComputerSystem.CreationClassName='Msvm_ComputerSystem', ElementName='CCS V1 Head'", "RequestStateChange", objInParam)


    tony soper
    • Als Antwort vorgeschlagentonysoperMSFTDonnerstag, 30. Oktober 2008 19:21
    • Als Antwort markierttonysoperMSFTDonnerstag, 30. Oktober 2008 19:21
    • Nicht als Antwort vorgeschlagentonysoperMSFTDonnerstag, 30. Oktober 2008 19:21
    •