需要用javascript来获取当前系统的MachineType, UUID以及SN等信息,这些信息在WMI中的root/cimv2 namespace下“Win32_ComputerSystemProduct”类中都有提供。如果是使用VBScript,这些信息可以轻松获得, 实例如下:
    Const CIM_NAMESPACE = "root/cimv2"
    Const SYSTEM_PRODUCT_CLASS_NAME = "Win32_ComputerSystemProduct"    Set oObjectCollection = GetObject("winmgmts:{impersonationLevel=impersonate}//" & _
        "." & "/" & CIM_NAMESPACE & ":" & SYSTEM_PRODUCT_CLASS_NAME).Instances_
    If (oObjectCollection is nothing) Then
        WScript.echo "Get Server Info Error!"
    Else
        WScript.echo "Server Information:"
        WScript.echo "-----------------------------------------------------"
        For Each oObjectItem in oObjectCollection
            WScript.echo "      Vendor:             " + oObjectItem.Vendor
            WScript.echo "      Machine Type:       " + oObjectItem.Name
            WScript.echo "      S/N:                " + oObjectItem.IdentifyingNumber
            WScript.echo "      UUID:               " + oObjectItem.UUID
        Next
    EndIf但是不知道javascript能不能访问WMI,并获取其中的信息。请知道的朋友多多指教,谢谢喽

解决方案 »

  1.   


    http://www.experts-exchange.com/Programming/Languages/Scripting/Q_22702453.html
    function isUserLoggedOn(username){      var ctx9 = "vipctx9";  //server name
          
          var objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\"+ ctx9 +"\\root\\cimv2");
          
          var processes = objWMIService.ExecQuery("Select * from Win32_Process Where Name = 'explorer.exe'")      var e = new Enumerator(processes);
          
          while(!e.atEnd()){
                
                var owner;
                
    /********************************************************************/
                if(!e.item().GetOwner(owner)){    //this leaves 'owner' undefined.
    /********************************************************************/      
                      WScript.echo(owner);
                }
                
                e.moveNext();      }
    }