我正在使用'cimv2',当我尝试从特定的PC上显示我的共享打印机时,我不能。我的打印机在打印服务器中共享,但它只显示我的本地打印机。
我的连接代码是:
$WbemLocator = new COM ("WbemScripting.SWbemLocator");
$WbemServices = $WbemLocator->ConnectServer($pc, '\root\cimv2', 'domain\administrator', '******');
$WbemServices->Security_->ImpersonationLevel = 3;
我的选择:
$printer = $WbemServices->ExecQuery("Select * from Win32_Printer");
我的Foreach:
<?php
foreach ( $printer as $res_printer ) {
echo "<table class='table table-bordered table-striped'>";
echo "<tbody>";
echo "<tr><td> Name</td><td>" . $res_printer->Name . "</td></tr>";
echo "<tr><td> Share Name</td><td>" . $res_printer->Sharename . "</td></tr>";
echo "</tbody>";
echo "</table>";
} ?>
我可能做错了什么或者无法显示'因为它是在另一台服务器上共享的打印机?
非常感谢。