全球主机交流论坛
标题:
找asp猛男
[打印本页]
作者:
xuyanjian
时间:
2012-10-24 14:52
提示:
作者被禁止或删除 内容自动屏蔽
作者:
fqi
时间:
2012-10-24 14:57
提示:
作者被禁止或删除 内容自动屏蔽
作者:
kwx
时间:
2012-10-24 14:58
Ho..目测这代码有点邪恶
作者:
fansfan
时间:
2012-10-24 15:02
asp是什么
作者:
Kvm
时间:
2012-10-24 15:03
把Wscript.Echo换成response.write
然后for循环里好像得改下
作者:
老刘
时间:
2012-10-24 15:05
为什么不做成php?微软都放弃asp了。。。
作者:
xuyanjian
时间:
2012-10-24 15:47
提示:
作者被禁止或删除 内容自动屏蔽
作者:
zzzu
时间:
2012-10-24 16:04
php.
作者:
niniwa
时间:
2012-10-24 16:06
美女要不?
作者:
哈哈大侠
时间:
2012-10-24 17:17
本帖最后由 哈哈大侠 于 2012-10-24 17:32 编辑
asp和vbs本来是一样的东西,但是有些对象要换一下,设置了下ContentType应该可以保持输出格式,语法什么喵了一下好像没什么问题,for那应该是这样的(循环数组)。GetObject在asp里没有要改下。调试无果,说字符无效,百度查了下发现是asp没有权限玩wmi,百度没找到调用wmi成功的例子,可以结贴了
给分吧,权限不够可是没办法的
<%
Response.ContentType = "text/plain"
strComputer = "."
' Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\virtualization")
Set objWMIService = Server.CreateObject("winmgmts:\" & strComputer & "\root\virtualization")
Set vmcollecion = objWMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem",,48)
Response.Write VbCrLF
Response.Write "Name Description State "
Response.Write "--------------------------------------- ---------------------------------- -------------"
' loop through all instances in collection
For each vm in vmcollecion
' decode system state, based on codes identified via trial and error
VMStateCode = vm.EnabledState
Select Case VMStateCode
Case 2 VMState = "Running"
Case 3 VMState = "PowerOff"
Case 4 VMState = "ShuttingDown"
Case 10 VMState = "Reset"
Case 32768 VMState = "Paused"
Case 32770 VMState = "Starting"
Case 32771 VMState = "SnapshotInProgress"
Case 32772 VMState = "Migrating"
Case 32773 VMState = "Saving"
Case 32774 VMState = "Stopping"
Case 32776 VMState = "Pausing"
Case 32777 VMState = "Resuming"
Case 32769 VMState = "Saved"
Case Else VMState = "Unclassified (so far)"
End Select
' print out VM info state
Response.Write VbCrLF
Response.Write vm.ElementName & Space(40 - Len(vm.ElementName)) & _
vm.Description & Space(35 - Len(vm.Description)) & _
VMState & " (" & VMStateCode & ")"
' request state change if appropriate - the host should never be eligible
if ( VMState = "Running" or VMState = "Paused") and vm.Description <> "Microsoft Hosting Computer System" Then
Response.Write Space(40) & "Saving " & vm.ElementName
RequestReturn = vm.RequestStateChange(32769)
if RequestReturn = 4096 Then
Response.Write Space(40) & "Save request submitted"
Else
Response.Write Space(40) & "Something goofy happened (" & RequestReturn & ")"
End If
End If
Next
Response.Write VbCrLF
%>
复制代码
欢迎光临 全球主机交流论坛 (https://fd.vvwvv.eu.org/)
Powered by Discuz! X3.4