From: Reventlov on 15 Sep 2010 16:52 Il giorno Wed, 15 Sep 2010 11:35:19 -0700 (PDT), RobMo <rob.moorhead(a)gmail.com> ha scritto: >I need to assign a certificate hash that is from the output of >certutil.exe to a variable. Here is the command line I need to run: a= capturedos("certutil.exe -enterprise -store trustedpublisher",true) arr=split(a, vbcrlf) for i=1 to ubound(a) if instr(arr(i),"Cert Hash",1)>0 then msgbox arr(i) next Function CaptureDOS( sCommand, bSynch ) Dim sFolder, sName, sTempFile Dim sResult, oFSO, DQ, TEMPORARY_FOLDER, AS_SYSTEMDEFAULT Dim const_read, oShell DQ=Chr(34) CONST_READ = 1 TEMPORARY_FOLDER = 2 AS_SYSTEMDEFAULT = -2 Set oFSO=CreateObject("scripting.filesystemobject") Set oShell = CreateObject( "WScript.Shell" ) sResult = vbNullString sFolder = oFSO.GetSpecialFolder( TEMPORARY_FOLDER ) sName = oFSO.GetTempName sTempFile = oFSO.BuildPath( sFolder, sName ) oShell.Run sCommand & "> " & DQ & sTempFile & DQ, 0, bSynch On Error Resume Next Set oStream = oFSO.OpenTextFile(sTempFile, CONST_READ, False, AS_SYSTEMDEFAULT ) sResult = oStream.ReadAll If Err.Number <> 0 Then sResult = vbNullString End If On Error GoTo 0 oStream.Close oFSO.DeleteFile( sTempFile ) CaptureDOS = sResult End Function -- Giovanni Cenati (Bergamo, Italy) Write to "Reventlov" at katamail com http://digilander.libero.it/Cenati (Esempi e programmi in VbScript) --
From: RobMo on 15 Sep 2010 18:04 On Sep 15, 1:52 pm, no...(a)no.void (Reventlov) wrote: > Il giorno Wed, 15 Sep 2010 11:35:19 -0700 (PDT), RobMo <rob.moorh...(a)gmail.com> ha > scritto: > > >I need to assign a certificate hash that is from the output of > >certutil.exe to a variable. Here is the command line I need to run: > > a= capturedos("certutil.exe -enterprise -store trustedpublisher",true) > arr=split(a, vbcrlf) > for i=1 to ubound(a) > if instr(arr(i),"Cert Hash",1)>0 then msgbox arr(i) > next > > Function CaptureDOS( sCommand, bSynch ) > Dim sFolder, sName, sTempFile > Dim sResult, oFSO, DQ, TEMPORARY_FOLDER, AS_SYSTEMDEFAULT > Dim const_read, oShell > DQ=Chr(34) > CONST_READ = 1 > TEMPORARY_FOLDER = 2 > AS_SYSTEMDEFAULT = -2 > Set oFSO=CreateObject("scripting.filesystemobject") > Set oShell = CreateObject( "WScript.Shell" ) > sResult = vbNullString > > sFolder = oFSO.GetSpecialFolder( TEMPORARY_FOLDER ) > sName = oFSO.GetTempName > sTempFile = oFSO.BuildPath( sFolder, sName ) > oShell.Run sCommand & "> " & DQ & sTempFile & DQ, 0, bSynch > > On Error Resume Next > Set oStream = oFSO.OpenTextFile(sTempFile, CONST_READ, False, AS_SYSTEMDEFAULT ) > sResult = oStream.ReadAll > If Err.Number <> 0 Then > sResult = vbNullString > End If > On Error GoTo 0 > oStream.Close > oFSO.DeleteFile( sTempFile ) > CaptureDOS = sResult > End Function > > -- > Giovanni Cenati (Bergamo, Italy) > Write to "Reventlov" at katamail comhttp://digilander.libero.it/Cenati(Esempi e programmi in VbScript) > -- Thank you very much! I will give this a shot...
|
Pages: 1 Prev: HTA Create User assign multiple groups Next: Help with writing a script |