加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

WMIC的格式化输出

(2021-08-09 09:25:03)
分类: 编程之乐
1.wmic=Microsoft Windows Management Instrumentation
2. C:\WINDOWS\system32\wbem 下的东西,特别是.xsl格式化文件,实现wmic的格式化输出
如wmic /output:c:\process.html process list /format:htable.xsl
/format:textvaluelist.xsl
/format:hform.xsl
/format:htable.xsl
/format:csv.xsl
/format:xml.xsl

wmic os       list brief /format:hform >PCinfo.html
wmic bios     list brief /format:hform >>PCinfo.html
wmic baseboard list brief /format:hform >>PCinfo.html
wmic csproduct list full /format:hform >>PCinfo.html
wmic cpu      list full /format:hform >>PCinfo.html
wmic nic       list full /format:hform >>PCinfo.html
wmic computersystem list brief /format:hform >>PCinfo.html
wmic diskdrive list full /format:hform >>PCinfo.html
wmic memphysical list full /format:hform >>PCinfo.html

获取网卡的MAC地址(WIN32_NETWORKADAPTER)

wmic nic list full | findstr "MACAddress"

wmic nic where ( MACAddress is not null) get adaptertype , MACAddress

wmic nic where (MACAddress is not null and  PNPDeviceID like '%PCI%' ) get adaptertype , MACAddress

wmic nicconfig get IPAddress /value | findstr /i "IPAddress=[^]"

参考:

WMI、WMIC应用教程

http://www.bathome.net/viewthread.php?tid=4068#pid25946

http://www.bathome.net/thread-4068-1-1.html

http://www.bathome.net/thread-420-1-1.html

http://www.bathome.net/thread-534-1-1.html

http://www.bathome.net/thread-377-1-1.html 

Windows WMIC命令使用详解(附实例)

 https://www.computerperformance.co.uk/

微软技术讨论1区

https://social.microsoft.com/Forums/zh-CN/home?category=comprehensivediscussioncn


  1. Nicconfig 别名
  2. wmic nicconfig where(index='8') call enablestatic "192.168.1.81","255.255.255.0"   
  3. 设置IP地址和子网掩码
  4. wmic nicconfig where(index='8') call setgateways "192.168.0.1",1          
  5. 设置网关和跃点数
  6. wmic nicconfig where(index='8') call setdnsdomain ("192.168.0.1","192.168.0.11")  
  7. 设置DNS服务器地址,设置完毕后不会马上生效,必需要设置主次才可以生效
  8. wmic nicconfig where(index='8') call SetDNSServerSearchOrder ("192.168.0.1","192.168.0.11") 
  9. 设置DNS服务器地址的主次顺序,192.168.0.1在前表示为首选DNS地址,在后为备用DNS地址
  10. wmic path Win32_NetworkAdapterConfiguration.index=8 call enabledhcp
  11. WMIC默认的NICCONFIG别名是不提供enabledhcp这个方法的,所以我们只能调用他的WMI函数来设置动态分配IP地址的设置
  12. wmic nicconfig where(index='8') get /value ###INDEX值为你当前网卡的索引值,每台机器都不一样




0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有