使用PHP远程查询WMI
我当前的代码如下所示:
define ( 'CPU_NAME', 'remote_server' );
$obj = new COM ( 'winmgmts:{impersonationLevel=impersonate}//' . CPU_NAME . '/root/cimv2' );
if ( is_object ( $obj ) ){
$process = $obj->execquery ( "SELECT * FROM Win32_Process" );
}
我将把远程服务器的登录凭据放在哪里? 我看到它需要用户名和密码,但我不确定如何实现。
任何帮助将不胜感激。
My current code looks like this:
define ( 'CPU_NAME', 'remote_server' );
$obj = new COM ( 'winmgmts:{impersonationLevel=impersonate}//' . CPU_NAME . '/root/cimv2' );
if ( is_object ( $obj ) ){
$process = $obj->execquery ( "SELECT * FROM Win32_Process" );
}
Where would I put the login credentials for the remote_server?
I see that it would take a username and password, but I'm not sure how to implement that.
Any help would be appreciated.
Reference: https://www.php.net/manual/en/class.com.php
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
连接
对于全局管理员
对于使用登录名和密码
获取信息
添加速度和套接字处理器的信息
获取其他信息简单 - 只需替换instancesof('Win32_Processor')的类
WMI 类信息
发送命令
链接:
WMI 不工作!
Component_Object_Model
Win32 类
对于 Yii 框架
CONNECTING
For global admins
For with login and password
GET INFORMATION
add information of speed and socket processor
get other information simple - just replace class for instancesof ('Win32_Processor')
Information of classes WMI
SEND COMMAND
Links:
WMI Isn't Working!
Component_Object_Model
Win32 Classes
For Yii Framework
我知道这个帖子不是最新的,但也许这个信息可以帮助某人。
如果您尝试在远程计算机上读取或写入注册表项或已安装的软件类,则需要在应该运行的查询下传递体系结构。你可以使用这样的东西。
查看我的 wmi.class.php: http://scbbb.blogspot .de/2014/02/wmi-via-php.html
I know this thread is not the newest but maby this info helps someone.
If you try to read or write Registy keys or installed Software class on a Remote Computer you need to pass the Architecture under the query should run. You can use something like this.
check out my wmi.class.php at: http://scbbb.blogspot.de/2014/02/wmi-via-php.html