首页 > 编程 > VBScript > 正文

vbs脚本大全,配有实例 DOS命令,批处理 脚本 代码

2019-10-26 17:59:22
字体:
来源:转载
供稿:网友
 VBS 
 取得本机IP
strComputer = "." 
Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/cimv2")
Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from
Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
For Each IPConfig in IPConfigSet 
If Not IsNull(IPConfig.IPAddress) Then 
For Each strAddress in IPConfig.IPAddress 
WScript.Echo strAddress 
Next 
End If 
Next  
2 取得本机计算机名 
 strComputer = "." 
Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/cimv2") 
Set colComputers = objWMIService.ExecQuery("Select * from Win32_ComputerSystem") 
For Each objComputer in colComputers 
Wscript.Echo objComputer.Name
Next 
4 检查升级包 
 strComputer = "." 
Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/cimv2") 
Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem") 
For Each objOperatingSystem in colOperatingSystems 
Wscript.Echo objOperatingSystem.ServicePackMajorVersion & "." &
objOperatingSystem.ServicePackMinorVersion
Next 
5 检查 Hot Fix 
 strComputer = "." 
Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/cimv2") 
Set colQuickFixes = objWMIService.ExecQuery ("Select * from Win32_QuickFixEngineering") 
For Each objQuickFix in colQuickFixes 
Wscript.Echo "Description: " & objQuickFix.Description 
Wscript.Echo "Hot Fix ID: " & objQuickFix.HotFixID 
Next 
6 检查本地管理员数目 
 Set objNetwork = CreateObject("Wscript.Network") 
strComputer = objNetwork.ComputerName 
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group") 
For Each objUser in objGroup.Members 
Wscript.Echo objUser.Name 
Next 
7 磁盘系统 
 strComputer = "." 
Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/cimv2") 
Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DriveType =
3") 
For Each objDisk in colDisks 
Wscript.Echo "Disk drive: "& objDisk.DeviceID & " -- " & objDisk.FileSystem 
Next 
8 检测自动登录是否开启 
 Const HKEY_LOCAL_MACHINE = &H80000002 
strComputer = "." 
Set objReg=GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv") 
strKeyPath = "Software/Microsoft/Windows NT/CurrentVersion/WinLogon" 
strValueName = "AutoAdminLogon" 
objReg.GetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName,dwValue 
If dwValue = 1 Then 
Wscript.Echo "Auto logon is enabled." 
Else 
Wscript.Echo "Auto logon is disabled." 
End If
9 关闭自动登录 
 Const HKEY_LOCAL_MACHINE = &H80000002 
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选