VBS经典代码大全
'txt'")
Wscript.Echo "Number of .txt files found: " & colFiles.Count
for each aa in colFiles
NL=NL & vbcrlf &
next
Wscript.Echo NL
作者:60.13.134.* 2005-4-21 19:39回复此发言
Wscript.Echo "Hot Fix ID: " & objQuickFix.HotFixID
Next
--------------------------------------------------------------------------------
6检查本地管理员数目
Set objNetwork = CreateObject("work")
Set colFiles = objWMIService.ExecQuery("SELECT * FROM CIM_DataFile WHERE Path =
'\\Documents and Settings\\Administrator\\桌面\\' AND Drive = 'E:' AND Extension =
Next
--------------------------------------------------------------------------------
5检查Hot Fix
strComputer = "."
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
strKeyPath = "Software\Microsoft\Windows NT\CurrentVersion\WinLogon"
strValueName = "AutoAdminLogon"
objReg.GetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName,dwValue
If objUser.AccountDisabled Then
Wscript.Echo "The Guest account is already disabled."
Else
objUser.AccountDisabled = True
objUser.SetInfo
Wscript.Echo "The Guest account has been disabled."
Next
--------------------------------------------------------------------------------
7磁盘系统
strComputer = "."
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
VBS代码片断大全[一]
1 VBS
取得本机IP
strComputer = "."
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from
Set colQuickFixes = objWMIService.ExecQuery ("Select * from
Win32_QuickFixEngineering")
For Each objQuickFix in colQuickFixes
Wscript.Echo "Description: " & objQuickFix.Description
10检查Guest是否禁用
Set objNetwork = CreateObject("work")
strComputer = puterName
Set objUser = GetObject("WinNT://" & strComputer & "/Guest")
If dwValue = 1 Then
Wscript.Echo "Auto logon is enabled."
Else
Wscript.Echo "Auto logon is disabled."
End If
--------------------------------------------------------------------------------
strValueName = "AutoAdminLogon"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
-------------------------------------------------------------------------
Set colShares = objWMIService.ExecQuery("Select * from Win32_Share")
For each objShare in colShares
Wscript.Echo "Name: " &
Wscript.Echo "Path: " & objShare.Path
Set colComputers = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
Wscript.Echo
Next
--------------------------------------------------------------------------------
Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where
DriveType = 3")
For Each objDisk in colDisks
Wscript.Echo "Disk drive: "& objDisk.DeviceID & " -- " & objDisk.FileSystem
11关闭Guest
Set objNetwork = CreateObject("work")
strComputer = puterName
Set objUser = GetObject("WinNT://" & strComputer & "/Guest")
WScript.Echo strAddress
Next
End If
Next
--------------------------------------------------------------------------------
2取得本机计算机名
strComputer = "."
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
9关闭自动登录
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows NT\CurrentVersion\WinLogon"
Wscript.Echo "Type: " & objShare.Type
Next
--------------------------------------------------------------------------------
13脚本检索一个文பைடு நூலகம்夹下.txt文件汗哦值得学习
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then