質問する質問する
 

回答済みScript to Start a VM?

回答

  • 2008年10月30日 19:21tonysoperMSFTユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     回答済みコードあり
    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

すべての返信

  • 2008年10月30日 19:21tonysoperMSFTユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダルユーザーのメダル
     回答済みコードあり
    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