欢迎来到天天文库
浏览记录
ID:47106082
大小:255.50 KB
页数:47页
时间:2019-08-04
《vbs经典代码手册》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、VBS代码片断大全[一]1VBS取得本机IPstrComputer="."SetobjWMIService=GetObject("winmgmts:"&strComputer&"rootcimv2")SetIPConfigSet=objWMIService.ExecQuery("SelectIPAddressfromWin32_NetworkAdapterConfigurationWhereIPEnabled=TRUE")ForEachIPConfiginIPConfigSetIfNotIsNull(IPConfig.IPAddress)ThenForEachstrAddre
2、ssinIPConfig.IPAddressWScript.EchostrAddressNextEndIfNext--------------------------------------------------------------------------------2取得本机计算机名strComputer="."SetobjWMIService=GetObject("winmgmts:"&strComputer&"rootcimv2")SetcolComputers=objWMIService.ExecQuery("Select*fromWin32_ComputerS
3、ystem")ForEachobjComputerincolComputersWscript.EchoobjComputer.NameNext--------------------------------------------------------------------------------4检查升级包strComputer="."SetobjWMIService=GetObject("winmgmts:"&strComputer&"rootcimv2")SetcolOperatingSystems=objWMIService.ExecQuery("Select*f
4、romWin32_OperatingSystem")ForEachobjOperatingSystemincolOperatingSystemsWscript.EchoobjOperatingSystem.ServicePackMajorVersion&"."&objOperatingSystem.ServicePackMinorVersionNext--------------------------------------------------------------------------------5检查HotFixstrComputer="."SetobjWMIServ
5、ice=GetObject("winmgmts:"&strComputer&"rootcimv2")SetcolQuickFixes=objWMIService.ExecQuery("Select*fromWin32_QuickFixEngineering")ForEachobjQuickFixincolQuickFixesWscript.Echo"Description:"&objQuickFix.DescriptionWscript.Echo"HotFixID:"&objQuickFix.HotFixIDNext------------------------------
6、--------------------------------------------------6检查本地管理员数目SetobjNetwork=CreateObject("Wscript.Network")strComputer=objNetwork.ComputerNameSetobjGroup=GetObject("WinNT://"&strComputer&"/Administrators,group")ForEachobjUserinobjGroup.MembersWscript.EchoobjUser.NameNext-------------------------
7、-------------------------------------------------------7磁盘系统strComputer="."SetobjWMIService=GetObject("winmgmts:"&strComputer&"rootcimv2")SetcolDisks=objWMIService.ExecQuery("Select*fromWin32_LogicalDiskWhereDriveType=3")ForEachobjDi
此文档下载收益归作者所有