vbs脚本大全,配有实例 DOS命令,批处理 脚本 代码
作者 佚名
来源 ASP编程
浏览
发布时间 2013-07-09
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 strComputer = "." Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") strKeyPath = "Software\Microsoft\Windows NT\CurrentVersion\WinLogon" strValueName = "AutoAdminLogon" dwValue = 0 oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue 10 检查Guest是否禁用 Set objNetwork = CreateObject("Wscript.Network") strComputer = objNetwork.ComputerName Set objUser = GetObject("WinNT://" & strComputer & "/Guest") If objUser.AccountDisabled Then Wscript.Echo "The Guest account is disabled." Else Wscript.Echo "The Guest account is enabled." End If 11 关 |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于vbs脚本大全,配有实例 DOS命令,批处理 脚本 代码的所有评论