Linux环境下如何通过WMI对windows进行监控
2017-01-16 16:11
1171 查看
以下内容使用到的一些工具请在http://download.csdn.net/detail/wqiancangq/9738919下载
sudo pip install wmic
sudo pip install wmic-client-wrapper
python 中代码
import wmi_client_wrapper as wmi
wmic = wmi.WmiClientWrapper(username="Administrator",password="P@ssw0rd",host="10.1.1.152")
终端中直接使用wmic命令
wmic -U Administrator%P@ssw0rd //10.1.1.152 "Select * from Win32_LogicalDisk"
$ wget http://www.openvas.org/download/wmi/wmi-1.3.14.tar.bz2
$ bzip2 -cd wmi-1.3.14.tar.bz2 | tar xf -
$ cd wmi-1.3.14/
$ sudo make
//sudo make "CPP=gcc -E -ffreestanding"
$ sudo cp Samba/source/bin/wmic /usr/local/bin/
Usage
Usage: wmic -U user%password //host "query"
注:需要安装gcc 需要安装autoconf和automake
tar -zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure
make
make install
tar -zxvf automake-1.14.tar.gz
cd automake-1.14
./bootstrap.sh
./configure
make
make install
其他文档:
WMIC is a useful tool in the world of remote management, and more specifically tracking the performance of Windows machines, so I thought I’d show how I got it installed on Ubuntu 12.04 LTS – Desktop. This should work fine on most other versions of Ubuntu
as well, but please comment if it did not.
Step 1 – Install autoconf which is used in the compilation process
Step 2 – Download the ‘wmic’ source (I will work in my ‘Downloads’ directory)
Step 3 – Untar the source
Step 4 – Go into the directory and add a line of text to the top of ‘GNUmakefile’
Step 5 – Compile
Step 6 – Test wmic
Step 7 – Copy wmic to /usr/bin so you can use it from anywhere
sudo pip install wmic
sudo pip install wmic-client-wrapper
python 中代码
import wmi_client_wrapper as wmi
wmic = wmi.WmiClientWrapper(username="Administrator",password="P@ssw0rd",host="10.1.1.152")
终端中直接使用wmic命令
wmic -U Administrator%P@ssw0rd //10.1.1.152 "Select * from Win32_LogicalDisk"
Installation
Pre-requisites
$ sudo aptitude install autoconf
Compilation
$ cd /data/tools/$ wget http://www.openvas.org/download/wmi/wmi-1.3.14.tar.bz2
$ bzip2 -cd wmi-1.3.14.tar.bz2 | tar xf -
$ cd wmi-1.3.14/
$ sudo make
//sudo make "CPP=gcc -E -ffreestanding"
$ sudo cp Samba/source/bin/wmic /usr/local/bin/
Usage
Usage: wmic -U user%password //host "query"
注:需要安装gcc 需要安装autoconf和automake
tar -zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure
make
make install
tar -zxvf automake-1.14.tar.gz
cd automake-1.14
./bootstrap.sh
./configure
make
make install
其他文档:
WMIC is a useful tool in the world of remote management, and more specifically tracking the performance of Windows machines, so I thought I’d show how I got it installed on Ubuntu 12.04 LTS – Desktop. This should work fine on most other versions of Ubuntu
as well, but please comment if it did not.
Step 1 – Install autoconf which is used in the compilation process
sudo apt-get install autoconf |
cd ~/Downloads wget http://www.openvas.org/download/wmi/wmi-1.3.14.tar.bz2 |
tar -xvf wmi-1.3.14.tar.bz2 |
#Go into the directory where the files were untarred tocd wmi-1.4.14/ #or whatever version you installed #Edit 'GNUmakefile' and add the following at the top (just after the License Info)ZENHOME=../.. |
sudo make #Now grab a magazine or something - this can take a few minutes #After a while you 'might' get something like this - I did ..... cp: target `../../lib/python' is not a directory make: *** [pywmi-installed] Error 1 #wmic is already compiled and usable at this stage so it's not an issue. Proceed to Step 6 |
#In the ~/Downloads/wmi-1.3.14/ directory you will find a file named 'bin'. Create a copy of this file and name it wmiccp bin wmic #Test it #./wmic -U[user]%[password] //[host/ip] "[WMI Query]" ./wmic -Utestuser%tstpass //172.16.2.2 "SELECT * FROM Win32_OperatingSystem" #Output should be similar to this: CLASS: Win32_OperatingSystem BootDevice|BuildNumber|BuildType|Caption|CodeSet|CountryCode|CreationClassName|CSCreationClassName|CSDVersion|CSName|CurrentTimeZone|Debug|Description|Distributed|EncryptionLevel|ForegroundApplicationBoost|FreePhysicalMemory|FreeSpaceInPagingFiles|FreeVirtualMemory|InstallDate|LargeSystemCache|LastBootUpTime|LocalDateTime|Locale|Manufacturer|MaxNumberOfProcesses|MaxProcessMemorySize|Name|NumberOfLicensedUsers|NumberOfProcesses|NumberOfUsers|Organization|OSLanguage|OSProductSuite|OSType|OtherTypeDescription|PAEEnabled|PlusProductID|PlusVersionNumber|Primary|ProductType|QuantumLength|QuantumType|RegisteredUser|SerialNumber|ServicePackMajorVersion|ServicePackMinorVersion|SizeStoredInPagingFiles|Status|SuiteMask|SystemDevice|SystemDirectory|SystemDrive|TotalSwapSpaceSize|TotalVirtualMemorySize|TotalVisibleMemorySize|Version|WindowsDirectory \Device\HarddiskVolume1|3790|Uniprocessor Free|Microsoft(R) Windows(R) Server 2003, Enterprise Edition|1252|1|Win32_OperatingSystem|Win32_ComputerSystem||WIN2003-VM-HS|120|False||False|168|2|779280|2348260|3127540|20121101081525.000000+120|1|20121101090258.411875+120|20121105103817.505000+120|0409|Microsoft Corporation|4294967295|2097024|Microsoft Windows Server 2003 Enterprise Edition|C:\WINDOWS|\Device\Harddisk0\Partition1|5|46|4|Sintrex Integration Services (Pty) Ltd|1033|274|18|(null)|False|(null)|(null)|True|3|0|0|Test User|69763-011-6394922-43753|0|0|2527020|OK|274|\Device\HarddiskVolume1|C:\WINDOWS\system32|C:|0|3575072|1048052|5.2.3790|C:\WINDOWS |
sudo cp wmic /usr/bin/ |
相关文章推荐
- Jprofiler在linux上的安装和配置,以及如何通过windows客户端监控JAVA应用程序
- 如何通过CuteFTP实现在windows环境下和Ubuntu进行文件相互传输
- SCOM 如何监控生产环境中的Linux&Unix机器 推荐
- 如何在linux环境下进行单片机开发学习!
- 如何去掉linux环境中C++代码中的^M,文件一般来自windows 下编辑的c++代码。
- 解析如何通过PHP函数获取当前运行的环境 来进行判断执行逻辑(小技巧)
- 如何通过LoadRunner监控Linux和Unix操作系统的资源状况
- windows环境下的cmd命令行如何用鼠标进行复制粘贴
- windows&linux通过securecrt进行文件传输
- 有关Windows和Linux双系统环境如何正确卸载Linux系统的方法总结
- 解析如何通过PHP函数获取当前运行的环境 来进行判断执行逻辑(小技巧)
- 如何通过putty的ssh在windows上使用linux的Xwindows-GUI程序 zz
- 在Windows 7下如何进行PHP和Apache配置环境
- 如何在DOS/Windows和Linux/Unix之间进行文件格式转换
- Windows是如何通过Kerberos进行Authentication的【转】
- 探讨如何在Linux上通过windows的域控制上网( by quqi99 )
- 如何在DOS/Windows和Linux/Unix之间进行文件格式转换?
- 【嵌入式Linux学习七步曲之第一篇 Linux主机开发环境】如何通过vnc图形界面远程控制Linux主机
- 如何在不需要安装光盘的前提下通过Win RE(Windows恢复环境)重装Windows 7
- windows下通过jconsole监控linux内存,cpu占用情况