Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Новый участник


Сообщения: 10
Благодарности: 0

Профиль | Отправить PM | Цитировать


УРА!!! СПАСИБО ОГРОМНОЕ!
С вашей помощью получилось сделать вот такой код:

Код: Выделить весь код
 
SAVEFILE "http://*****1/garant.crl", "GE", "certutil -split c:\scriptcheckcrl\GEgarant.crl", objExec1, "GEgarant.txt" 
SAVEFILE "http://*****1/garant2.crl", "GE", "certutil -split c:\scriptcheckcrl\GEgarant2.crl", objExec2, "GEgarant2.txt" 
SAVEFILE "http://*****2/garant.crl", "CA1", "certutil -split c:\scriptcheckcrl\CA1garant.crl", objExec3, "CA1garant.txt" 
SAVEFILE "http://*****2/garant2.crl", "CA1", "certutil -split c:\scriptcheckcrl\CA1garant2.crl", objExec4, "CA1garant2.txt" 
SAVEFILE "http://*****3/garant.crl", "CA2", "certutil -split c:\scriptcheckcrl\CA2garant.crl", objExec5, "CA2garant.txt" 
SAVEFILE "http://*****3/garant2.crl", "CA2", "certutil -split c:\scriptcheckcrl\CA2garant2.crl", objExec6, "CA2garant2.txt" 

 
'__________Процедура на скачивание и на преобразование CRL в TXT 

  
Sub SAVEFILE(URL1, Base_Name, Command, OBJ1, TXT) 
strFileURL = URL1 
URL = Split(StrReverse(strFileURL), "/") 
basename = Base_Name & StrReverse(URL(0)) 

strHDLocation = "C:\scriptcheckcrl\" & basename 
Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP") 
objXMLHTTP.open "GET", strFileURL, false 
objXMLHTTP.send() 

  
If objXMLHTTP.Status = 200 Then 
 Set objADOStream = CreateObject("ADODB.Stream") 
 objADOStream.Open 
 objADOStream.Type = 1 'adTypeBinary 
 objADOStream.Write objXMLHTTP.ResponseBody 
 objADOStream.Position = 0 'Set the stream position to the start 
 Set objFSO = Createobject("Scripting.FileSystemObject") 
   If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation 
 Set objFSO = Nothing 
 objADOStream.SaveToFile strHDLocation 
 objADOStream.Close 
 Set objADOStream = Nothing 
End if 

Set objXMLHTTP = Nothing 
Set objShell = CreateObject("WScript.Shell") 
strCommand1 = Command 

Set OBJ1 = objShell.Exec(strCommand1) 
While objExec1.Status = 0 
        WScript.Sleep 20 
Wend 
strOutput = Replace(OBJ1.StdOut.ReadAll, VbCrLf & "CertUtil: -split command completed successfully.", "") 
  
With WScript.CreateObject("Scripting.FileSystemObject").CreateTextFile(TXT, True) 
    .Write strOutput 
    .Close 
End With 

End Sub 

  
'____________________________________________________________________________ 
Dim fName(5) 
Dim objFSO 
Dim i 
Dim txtFile 
Dim ReadLineTXT 
Dim checkLic 
Dim strMsg 
Dim objCDO 
Dim Conf 
Dim DataCrl(5) 
 
fName(0) = "c:\scriptcheckcrl\GEgarant.txt" 
fName(1) = "c:\scriptcheckcrl\GEgarant2.txt" 
fName(2) = "c:\scriptcheckcrl\CA1garant.txt" 
fName(3) = "c:\scriptcheckcrl\CA1garant2.txt" 
fName(4) = "c:\scriptcheckcrl\CA2garant.txt" 
fName(5) = "c:\scriptcheckcrl\CA2garant2.txt" 

  
Set objFSO= WScript.CreateObject("Scripting.FileSystemObject") 

'_____________!!!!!!!!НАХОЖДЕНИЕ СТРОКИ С ДАТОЙ 
For i = 0 To UBound(fName) 
  Set txtFile = objFSO.OpenTextFile(fName(i)) 
  Do While Not txtFile.AtEndOfStream 
    If InStr(txtFile.ReadLine, "Следующая публикация CRL") Then 
      ReadLineTXT = txtFile.ReadLine 
      checkLic = checkLic + SMS(ReadLineTXT) 
  DataCrl(i) = ReadLineTXT 
      Exit Do 
    End If 
  Loop 
  txtFile.Close 
Next 
 
'_____________!!!!!!!!ФУНКЦИЯ СРАВНЕНИЯ ДАТЫ В ФАЙЛЕ С ТЕКУЩЕЙ 

Function SMS(STR) 
  If DateDiff("n", CDate(Replace(STR, "г.", "")), Now) > 9 Then 
    SMS = 0 
  Else 
    SMS = 1 
  End If 
End Function 
  
'_____________!!!!!!!!СРАВНЕНИЕ СТАТУСОВ КАЖДОГО ФАЙЛА 
 
If checkLic = 6 Then 
  strMsg = "Не просрочена" 
Else 
  strMsg = "Просрочена" 
End If 

'_____________!!!!!!!!СООБЩЕНИЕ НА ПОЧТОВЫЙ ЯЩИК 
  
Set objCDO = WScript.CreateObject("CDO.Message") 
objCDO.From = "ОТ КОГО"     
objCDO.To = "КОМУ" 
objCDO.Subject = "Проверка CRL" 

objCDO.HTMLBody = strMsg & "<br>" & "<br>" & "GEgarant.txt" & DataCrl(0) & "<br>" &  "GEgarant2.txt" & DataCrl(1) & "<br>" &  "CA1garant.txt" & DataCrl(2) & "<br>" &  "CA1garant2.txt" & DataCrl(3) & "<br>" &  "CA2garant.txt" & DataCrl(4) & "<br>" &  "CA2garant2.txt" & DataCrl(5) 

Set Conf = objCDO.Configuration 
  Conf("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2     
  Conf("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp сервер" 
' Conf("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 
  Conf("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 
' Conf("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Login" 
' Conf("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Pass" 
  Conf("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
Conf.Fields.Update 
  
objCDO.Send 

Set objFSO = Nothing 
Set objCDO = Nothing 
 
WScript.Quit
!!! Объясните только, почему создается в папке ещё Blob0_0.crl ????

Отправлено: 14:39, 09-09-2011 | #6