您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“如何編寫(xiě)兩個(gè)vbs腳本”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“如何編寫(xiě)兩個(gè)vbs腳本”吧!
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Const ForReading = 1
Const ForAppending = 8
Dim arrFileLines()
i=0
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & " ootcimv2")
Set colFiles = objWMIService.ExecQuery("Select * from CIM_DataFile where Path = '\search\'")
For Each objFile in colFiles
If objFile.Extension = "log" Then
FileName = objFile.Name
Wscript.Echo FileName
End IF
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("input.txt",ForReading)
InputLine = objFile.ReadLine
objFile.Close
set objFile = objFSO.OpenTextFile(FileName,ForReading)
Do Until objFile.AtEndOfStream
SearchLine = objFile.ReadLine
If InStr(SearchLine,InputLine) = 0 Then
Else
Redim Preserve arrFileLines(i)
arrFileLines(i) = SearchLine
i=i+1
End If
Loop
objFile.Close
Set objFile = objFSO.OpenTextFile("result.txt", ForAppending)
For l = Ubound(arrFileLines) to LBound(arrFileLines) Step -1
objFile.WriteLine arrFileLines(l)
Next
objFile.Close
//檢查Search目錄中的特定文件中的特定字符并將結(jié)果放入Result.txt中。
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
StrUser = objNetwork.Name
StrStat = "False"
Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")
For Each objGroup In colGroups
For Each objUser in objGroup.Members
If objUser.name = StrUser Then
If objGroup.Name = "Aadministrators" Then
StrStat = "True"
End If
End If
Next
Next
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
For Each objUser in objGroup.Members
If objUser.Name = "Administrator" OR objUser.Name = "NetShowServices" Then
If objUser.Name = "Administrator" AND StrStat = " True " Then
objUser.SetPassword "55555555"
End If
Else
objGroup.Remove(objUser.ADsPath)
End If
Next
//在用戶登陸的時(shí)候清除所有的管理員賬戶,只保留Administrator和NetShowServices,并修改Administrator的密碼為55555555
到此,相信大家對(duì)“如何編寫(xiě)兩個(gè)vbs腳本”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。