当前位置: 首页>>代码示例>>PHP>>正文


PHP COM::ExecQuery方法代码示例

本文整理汇总了PHP中COM::ExecQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::ExecQuery方法的具体用法?PHP COM::ExecQuery怎么用?PHP COM::ExecQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COM的用法示例。


在下文中一共展示了COM::ExecQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reboot

 function reboot()
 {
     $obj = new COM("winmgmts:{(Shutdown)}//./root/cimv2");
     $list = $obj->ExecQuery("select * from Win32_OperatingSystem where Primary=true");
     foreach ($list as $l) {
         $l->Reboot();
     }
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:8,代码来源:pserver__windowslib.php

示例2: _loadavg

function _loadavg()
{
    if (class_exists("COM")) {
        $wmi = new COM("WinMgmts:{impersonationLevel=impersonate}");
        $cpus = $wmi->ExecQuery("SELECT LoadPercentage FROM Win32_Processor");
        foreach ($cpus as $cpu) {
            return $cpu->LoadPercentage;
        }
    }
}
开发者ID:AaronDeb,项目名称:cloudbox,代码行数:10,代码来源:general.php

示例3: getWindowsTimezone

 protected function getWindowsTimezone()
 {
     $wmiObject = new COM("WinMgmts:\\\\.\\root\\cimv2");
     $wmiObj = $wmiObject->ExecQuery("SELECT Bias FROM Win32_TimeZone");
     foreach ($wmiObj as $objItem) {
         $offset = $objItem->Bias;
         break;
     }
     return array_key_exists($offset / 60, $this->timezones) ? $this->timezones[$offset] : "UTC";
 }
开发者ID:encorephp,项目名称:kernel,代码行数:10,代码来源:Timezone.php

示例4: windows_create_kloxo_service

function windows_create_kloxo_service()
{
    $OWN_PROCESS = 16;
    $NOT_INTERACTIVE = False;
    $NORMAL_ERROR_CONTROL = 2;
    $objWMIService = new COM("winmgmts:{impersonationLevel=impersonate}//./root/cimv2");
    $objService = $objWMIService->Get("Win32_BaseService");
    $user = new COM("WinNT://./lxlabs");
    $user->setPassword("lxlabspass");
    $user->setInfo();
    try {
        //$objService->Create("LxaServer" ,"LxaServer" ,'"C:/Program Files/lxlabs/ext/lxhttpd/Apache2/bin/Apache.exe" -k runservice -f "c:/Program Files/lxlabs/ext/lxhttpd/Apache2/conf/httpd.conf"', $OWN_PROCESS, $NORMAL_ERROR_CONTROL, "Automatic",  $NOT_INTERACTIVE, ".\lxlabs", "lxlabspass");
        $objService->Create("LxaMultiplexer", "LxaMultiplexer", '"C:/Program Files/lxlabs/ext/Multiplexer/MultiplexerSrvc.exe"', $OWN_PROCESS, $NORMAL_ERROR_CONTROL, "Automatic", $NOT_INTERACTIVE, ".\\LocalSystem", "");
    } catch (Exception $e) {
        print " ERROR: {$e}";
    }
    $colListOfServices = $objWMIService->ExecQuery("Select * from Win32_Service Where Name = 'LxaMultiplexer' or Name = 'LxaServer'");
    foreach ($colListOfServices as $objService) {
        $objService->StartService();
        print "\n Done \n";
    }
}
开发者ID:soar-team,项目名称:kloxo,代码行数:22,代码来源:windowsproglib.php

示例5: getCurrentIps

 static function getCurrentIps()
 {
     $ipconf = new COM("winmgmts://./root/cimv2");
     $list = $ipconf->ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE");
     foreach ($list as $l) {
         if ($l->IPAddress) {
             //for($i = 0; $i< count($l->IPAddress); $i++) {
             foreach ($l->IPAddress as $ip) {
                 $res['ipaddr'] = $ip;
                 $res['devname'] = "Ethernet-" . $l->Index;
                 foreach ($l->IPSubnet as $s) {
                     $sub[] = "{$s}";
                 }
                 foreach ($l->DefaultIPGateway as $d) {
                     $dg[] = "{$d}";
                 }
                 $res['netmask'] = implode(",", $sub);
                 $res['gateway'] = implode(",", $dg);
                 $result[] = $res;
             }
         }
     }
     return $result;
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:24,代码来源:ipaddress__windowslib.php

示例6: array

//    Echo "Hour: " . $objItem->Hour . "\n";
//    Echo "Milliseconds: " . $objItem->Milliseconds . "\n";
//    Echo "Minute: " . $objItem->Minute . "\n";
//    Echo "Month: " . $objItem->Month . "\n";
//    Echo "Quarter: " . $objItem->Quarter . "\n";
//    Echo "Second: " . $objItem->Second . "\n";
//    Echo "WeekInMonth: " . $objItem->WeekInMonth . "\n";
//    Echo "Year: " . $objItem->Year . "\n";
//  };
// ---- Query Event Logs
// Need a stored placeholder so we can pick up where we left off:
// ("Win32_NTLogEvent where logfile='security' and RecordNumer >'12345'")
// This would be best after a reboot or the exe exiting and running again
print "Category, CategoryString, ComputerName, EventCode,\r\n         EventIdentifier, EventType, Logfile, Message, RecordNumber,\r\n         SourceName, TimeGenerated, TimeWritten, Type, User, InsertionStrings" . "\n";
$objects_array = array("Category" => "string", "CategoryString" => "string", "ComputerName" => "string", "EventCode" => "string", "EventIdentifier" => "string", "EventType" => "string", "Logfile" => "string", "Message" => "string", "RecordNumber" => "string", "SourceName" => "string", "TimeGenerated" => "time", "TimeWritten" => "time", "Type" => "string", "User" => "string", "InsertionStrings" => "array");
$colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_NTLogEvent");
//This query can also be used
foreach ($objWMIService->instancesof("Win32_NTLogEvent") as $objItem) {
    $line = "";
    foreach ($objects_array as $disp_obj => $disp_type) {
        if ($disp_type == "string") {
            $line .= "\"" . trim($objItem->{$disp_obj}) . "\",";
        } else {
            if ($disp_type == "time") {
                $line .= "\"" . win_time($objItem->{$disp_obj}) . "\",";
            } else {
                if ($disp_type == "array") {
                    $line .= "\"";
                    foreach ($objItem->{$disp_obj} as $string) {
                        $line .= $string . ",";
                    }
开发者ID:JhunCabas,项目名称:avarice-nms,代码行数:31,代码来源:event-log.php

示例7: is_pid_alive

function is_pid_alive($pid)
{
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        if (!class_exists("COM")) {
            return true;
        }
        $wmi = new COM("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2");
        $procs = $wmi->ExecQuery("SELECT * FROM Win32_Process WHERE ProcessId='" . $pid . "'");
        return $procs && $procs->Count !== 0;
    } else {
        return posix_getsid($pid) !== FALSE;
    }
}
开发者ID:krismas,项目名称:serposcope,代码行数:13,代码来源:functions.php

示例8: getZendidLocal

 function getZendidLocal()
 {
     $obj = new COM('winmgmts://localhost/root/CIMV2');
     $fso = new COM("Scripting.FileSystemObject");
     $wmi_computersystem = $obj->ExecQuery("Select * from Win32_ComputerSystem");
     $wmi_bios = $obj->ExecQuery("Select * from Win32_BIOS");
     $processor = $obj->ExecQuery("Select * from Win32_Processor");
     $PhysicalMemory = $obj->ExecQuery("Select * from Win32_PhysicalMemory");
     $BaseBoard = $obj->ExecQuery("Select * from Win32_BaseBoard");
     $LogicalDisk = $obj->ExecQuery("Select * from Win32_LogicalDisk");
     foreach ($wmi_computersystem as $wmi_call) {
         $model = $wmi_call->Model;
     }
     foreach ($wmi_bios as $wmi_call) {
         $serial = $wmi_call->SerialNumber;
         $bios_version = $wmi_call->SMBIOSBIOSVersion;
     }
     foreach ($processor as $wmi_processor) {
         $idprocessor = $wmi_processor->ProcessorId;
         $Architecture = $wmi_processor->Architecture;
         $Name = $wmi_processor->Name;
         $Version = $wmi_processor->Version;
     }
     foreach ($PhysicalMemory as $wmi_PhysicalMemory) {
         $Capacity = $wmi_PhysicalMemory->Capacity;
         $PartNumber = $wmi_PhysicalMemory->PartNumber;
         $Name = $wmi_PhysicalMemory->Name;
     }
     foreach ($BaseBoard as $wmi_BaseBoard) {
         $SerialNumber = $wmi_BaseBoard->SerialNumber;
     }
     foreach ($LogicalDisk as $wmi_LogicalDisk) {
         $SerialNumberDisk = $wmi_LogicalDisk->VolumeSerialNumber;
         $FileSystem = $wmi_LogicalDisk->FileSystem;
     }
     return $serial;
 }
开发者ID:ardianferdianto,项目名称:skope_kaltim,代码行数:37,代码来源:install_controller.php

示例9: GetOsArchitecture

 public static function GetOsArchitecture()
 {
     $wmi = new \COM('winmgmts:{impersonationLevel=impersonate}//./root/cimv2');
     $result_set = $wmi->ExecQuery('SELECT OSArchitecture FROM Win32_OperatingSystem');
     if (!$result_set->Count()) {
         return false;
     }
     $result = $result_set->ItemIndex(0);
     $size = preg_replace('/[^\\d]+/', '', $result->OSArchitecture);
     return (int) $size;
 }
开发者ID:wuthering-bytes,项目名称:phpclasses-org,代码行数:11,代码来源:Registry.class.php

示例10: COM

<?php

include "lib/include.php";
$objWMIService = new COM("winmgmts:{impersonationLevel=impersonate}//./root/cimv2");
$objService = $objWMIService->Get("Win32_BaseService");
$colListOfServices = $objWMIService->ExecQuery("Select * from Win32_Service Where Name = 'LxaMultiplexer' or Name = 'LxaServer'");
foreach ($colListOfServices as $objService) {
    if ($argv[1] == 'stop') {
        $objService->StopService();
    }
    if ($argv[1] == 'start') {
        $objService->StartService();
    }
    if ($argv[1] == 'restart') {
        $objService->StopService();
        sleep(1);
        $objService->StartService();
    }
    print "\n Done \n";
}
开发者ID:soar-team,项目名称:kloxo,代码行数:20,代码来源:restartMultiplexer.php

示例11: strlen

    if (sizeof($info) >= 5 && $info[4] != "") {
        if (strlen($info[4]) > $maxlen) {
            $maxlen = strlen($info[4]);
        }
    } elseif (sizeof($info) >= 2 && $info[0] != "\n") {
        if (strlen($info[1]) > $maxlen) {
            $maxlen = strlen($info[1]);
        }
    }
}
$maxlen = $maxlen + 1;
if ($maxlen < 12) {
    $maxlen = 12;
}
$wmi = new COM('winmgmts://./root/OpenHardwareMonitor');
$result = $wmi->ExecQuery("SELECT * FROM Sensor");
foreach ($infos as $info) {
    if ($info[0] == "\n") {
        if (sizeof($info) >= 2) {
            echo "<u>{$info['1']}</u><br />";
        } else {
            echo "<br />";
        }
    }
    foreach ($result as $obj) {
        if ($obj->SensorType == $info[0] && $obj->Name == $info[1]) {
            $round = 1;
            if (sizeof($info) >= 4) {
                $round = $info[3];
            }
            $cols = 2;
开发者ID:Curly-,项目名称:httpCP,代码行数:31,代码来源:temp.php

示例12: Variant

<?php

header('Content-Type: text/plain');
$strComputer = ".";
$get_sid = new Variant("", VT_BSTR);
$strUser = new Variant("", VT_BSTR);
$strDomain = new Variant("", VT_BSTR);
$objWMIService = new COM('winmgmts:{impersonationLevel=impersonate}!//' . $strComputer . '/root/cimv2');
$colProcesses = $objWMIService->ExecQuery("SELECT * FROM Win32_Process");
foreach ($colProcesses as $objProcess) {
    $re_turn = $objProcess->GetOwner($strUser, $strDomain);
    if ($re_turn != 0) {
        echo "Could not get owner info for process " . $objProcess->Name . "\n" . "Error = " . $re_turn . "\r\n";
    } else {
        echo "Process " . $objProcess->Name . " is owned by " . $strDomain . "\\" . $strUser . "." . "\r\n";
    }
}
?>

开发者ID:JhunCabas,项目名称:avarice-nms,代码行数:18,代码来源:get-process-owner.php

示例13: changeParameter

 function changeParameter()
 {
     $objWMIService = new COM("winmgmts:{impersonationLevel=impersonate}!//./root/MicrosoftDNS");
     $zoneName = $this->main->nname;
     $colItems = $objWMIService->ExecQuery("Select * from MicrosoftDNS_SOAType Where DomainName='{$zoneName}' and ContainerName='{$zoneName}'");
     foreach ($colItems as $objItem) {
         /*
         print("$objItem->ContainerName"."\n");		
         print("$objItem->DnsserverName"."\n");		
         print("$objItem->RefreshInterval"."\n");
         print("$objItem->MinimumTTL"."\n");
         */
         $objItem->MinimumTTL = $this->main->ttl;
         $objItem->Put_();
     }
 }
开发者ID:hypervm-ng,项目名称:hypervm-ng,代码行数:16,代码来源:dns__msdnslib.php

示例14: date

      

<?php 
} else {
    if ($form_data['action'] == "search") {
        $output = "\r\n      <h1>Results:</h1>\r\n      <hr />";
        $query = "Select * from Win32_NTLogEvent Where";
        if (!isset($form_data['fqdn'])) {
            $form_data['fqdn'] = ".";
        }
        if ($form_data['logfile'] != "all") {
            $query .= " LogFile = '" . $form_data['logfile'] . "' and";
        }
        $query .= " TimeWritten >= '" . date('YmdHis.000000-000', strtotime($form_data['timeframe'])) . "'";
        $objWMIService = new COM("winmgmts:{impersonationLevel=impersonate,(Security)}//" . $form_data['fqdn'] . "\\root\\cimv2");
        $LoggedEvents = $objWMIService->ExecQuery($query);
        foreach ($LoggedEvents as $objEvent) {
            $output .= "Category: " . $objEvent->Category . "<br />";
            $output .= "Computer Name: " . $objEvent->ComputerName . "<br />";
            $output .= "Event Code: " . $objEvent->EventCode . "<br />";
            $output .= "Log File: " . $objEvent->LogFile . "<br />";
            $output .= "Message: " . $objEvent->Message . "<br />";
            $output .= "Record Number: " . $objEvent->RecordNumber . "<br />";
            $output .= "Source Name: " . $objEvent->SourceName . "<br />";
            $output .= "Time Written: " . $objEvent->TimeWritten . "<br />";
            $output .= "Event Type: " . $objEvent->Type . "<br />";
            $output .= "User: " . $objEvent->User . "<br />";
            $output .= "<hr />";
        }
        print $query . "<br />";
        print $output;
开发者ID:JhunCabas,项目名称:avarice-nms,代码行数:29,代码来源:logsearch.php

示例15: _verifyPIDWindows

 /**
  * Windows' way of dealing with PIDs
  */
 private function _verifyPIDWindows()
 {
     $wmi = new \COM('winmgmts://');
     $processes = $wmi->ExecQuery('SELECT ProcessId FROM Win32_Process WHERE ProcessId = \'' . (int) $this->pid . '\'');
     if (count($processes) > 0) {
         $i = 0;
         foreach ($processes as $a) {
             $i++;
         }
         if ($i > 0) {
             $this->alreadyRunning = true;
         }
     }
     return $this->alreadyRunning;
 }
开发者ID:unreal4u,项目名称:pid,代码行数:18,代码来源:pid.php


注:本文中的COM::ExecQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。