Этим скриптом ежедневно машины сдают свой программный конфиг на сервер:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
em BEGIN const HKLM = &H80000002 on Error resume next outCon=right(LCase(wScript.FullName),11)="cscript.exe" outFile="" out_all=0 FMT=1 ' 0 - Text ' 1 - CSV ' 2 - HTM strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" Set objReg = GetObject("winmgmts://./root/default:StdRegProv") objReg.EnumKey HKLM, strKey, arrSubkeys S="" T="" T=out(T,"INSTDATE",11,FMT<>3) T=out(T,"VER",8,FMT<>3) T=out(T,"NAME",0,FMT<>3) outstr(T) for each strSubkey in arrSubkeys T="" AppName="" InstDate="" verMajor="" verMinor="" ver="" Siz="" if objReg.GetStringValue(HKLM, strKey & strSubkey, "DisplayName", AppName) <> 0 then objReg.GetStringValue HKLM, strKey & strSubkey, "QuietDisplayName", AppName end if if len(AppName)>0 then objReg.GetStringValue HKLM, strKey & strSubkey, "InstallDate", InstDate objReg.GetDWORDValue HKLM, strKey & strSubkey, "VersionMajor", verMajor objReg.GetDWORDValue HKLM, strKey & strSubkey, "VersionMinor", verMinor objReg.GetDWORDValue HKLM, strKey & strSubkey, "EstimatedSize", Siz ver=verMajor & "." & verMinor if ver="." then ver="" T=out(T,InstDate,11,FMT<>3) T=out(T,ver,10,FMT<>3) T=out(T,AppName,0,FMT<>3) outstr(T) end if next outEnd() function out(Ret, T, N, Q) if IsNull(T) then T="" if Q then select case FMT case 0 if N>0 then if N>len(T) then Ret=Ret & T & space(N-len(T)) if N0 then Ret=Ret & "," Ret=Ret & qw(T) case 2 if len(T)=0 then T=" " Ret=Ret & " " & T & " " & vbCrLf end select end if out=Ret end function sub outstr(text) if FMT=2 then text=" " & vbCrLf & text & " " if len(S)=0 then text="" & vbCrLf & " <table border="1" cellspacing=" & qw(">" & vbCrLf & text end if end if if outCon then if len(outFile)=0 then wScript.echo text end if end if S=S & text & vbCrLf end sub sub outEnd T="</table> " & vbCrLf & "" & vbCrLf if FMT=2 then S=S & T if not outCon then if len(outFile)=0 then WScript.echo(S) else if FMT=2 then if len(outFile)=0 then WScript.echo T end if end if if len(outFile)>0 then set fso=CreateObject("Scripting.FileSystemObject") set file=fso.OpenTextFile(outFile, 2, true) file.write(S) file.close end if end sub function qw(T) qw=chr(34) & T & chr(34) end function |
(источник – с форума sysadmins.ru)