us0r
Full Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору const ForReading= 1 Dim nameServer, nameNamespace, nameImpLevel, WMIObj Dim GetLicenses, dictInfo, keyname Dim fs, fsScriptDir, fsInfo1File, fsfile Dim cntr, tgtFilename, a cntr=0 nameServer= "." nameNamespace="root\cimv2" nameImpLevel=3 tgtFilename="\TEST" Set dictInfo=CreateObject("Scripting.Dictionary") Set WBEMLoc= CreateObject("WbemScripting.SWbemLocator") Set fs=CreateObject("Scripting.FileSystemObject") Set fsfile=CreateObject("Scripting.FileSystemObject") fsScriptDir=fs.GetParentFolderName(WScript.ScriptFullName) Set WMIObj= WBEMLoc.ConnectServer(nameServer,nameNamespace) WMIObj.Security_.ImpersonationLevel = nameImpLevel Set GetInfo= WMIObj.ExecQuery("SELECT * FROM SoftwareLicensingProduct WHERE Description like '%Windows%%KMSCLIENT%' OR Description like '%Office%%KMSCLIENT%'") for each License in GetInfo cntr=cntr + 1 keyname= "ID_" & cntr dictInfo.add keyname, License.ID WScript.Echo keyname & " " &dictInfo(keyname) next 'WScript.Echo fsScriptDir set fsInfo1File = fsfile.OpenTextFile(fsScriptDir & "\" & tgtFilename, ForReading) Do until fsInfo1File.AtEndOfStream curString= fsInfo1File.ReadLine if InStr(curString, dictInfo("ID_1")) <> 0 Then 'WScript.Echo curString a=Split(curString," ",-1) WScript.Echo a(0) End If if InStr(curString, dictInfo("ID_2")) <> 0 Then 'WScript.Echo curString b=Split(curString," ",-1) WScript.Echo b(0) End If Loop fsInfo1File.Close() Set GetLicenses=Nothing Set nameServer=Nothing Set nameNamespace=Nothing Set nameImpLevel=Nothing Set WBEMLoc=Nothing Set WMIObj=Nothing Set fsInfo1File=Nothing Set a=Nothing | Всего записей: 406 | Зарегистр. 06-12-2007 | Отправлено: 14:02 26-09-2021 | Исправлено: us0r, 14:33 26-09-2021 |
|