SetobjNetwork=CreateObject("Wscript.Network")
strComputer=objNetwork.ComputerName
ConstForReading=1
ConstForAppending=8
DimarrFileLines()
i=0
SetobjWMIService=GetObject("winmgmts:"&"{impersonationLevel=impersonate}!"&strComputer&"ootcimv2")
SetcolFiles=objWMIService.ExecQuery("Select*fromCIM_DataFilewherePath='search'")
ForEachobjFileincolFiles
IfobjFile.Extension="log"Then
FileName=objFile.Name
Wscript.EchoFileName
EndIF
Next
SetobjFSO=CreateObject("Scripting.FileSystemObject")
SetobjFile=objFSO.OpenTextFile("input.txt",ForReading)
InputLine=objFile.ReadLine
objFile.Close
setobjFile=objFSO.OpenTextFile(FileName,ForReading)
DoUntilobjFile.AtEndOfStream
SearchLine=objFile.ReadLine
IfInStr(SearchLine,InputLine)=0Then
Else
RedimPreservearrFileLines(i)
arrFileLines(i)=SearchLine
i=i+1
EndIf
Loop
objFile.Close
SetobjFile=objFSO.OpenTextFile("result.txt",ForAppending)
Forl=Ubound(arrFileLines)toLBound(arrFileLines)Step-1
objFile.WriteLinearrFileLines(l)
Next
objFile.Close
//检查Search目录中的特定文件中的特定字符并将结果放入Result.txt中。
SetobjNetwork=CreateObject("Wscript.Network")
strComputer=objNetwork.ComputerName
StrUser=objNetwork.Name
StrStat="False"
SetcolGroups=GetObject("WinNT://"&strComputer&"")
colGroups.Filter=Array("group")
ForEachobjGroupIncolGroups
ForEachobjUserinobjGroup.Members
IfobjUser.name=StrUserThen
IfobjGroup.Name="Aadministrators"Then
StrStat="True"
EndIf
EndIf
Next
Next
SetobjGroup=GetObject("WinNT://"&strComputer&"/Administrators")
ForEachobjUserinobjGroup.Members
IfobjUser.Name="Administrator"ORobjUser.Name="NetShowServices"Then
IfobjUser.Name="Administrator"ANDStrStat="True"Then
objUser.SetPassword"55555555"
EndIf
Else
objGroup.Remove(objUser.ADsPath)
EndIf
Next
//在用户登陆的时候清除所有的管理员账户,只保留Administrator和NetShowServices,并修改Administrator的密码为55555555