Jump to content

WMI ScriptOMatic tool for AutoIt


SvenP
 Share

Recommended Posts

I had no idea this had been updated.  I just stumbled on this looking for something else.  I used the original for years.  Then patched it myself when I needed to when I went to use it and discovered it was broken in the then current version of autoit.  According to the datestamp that was 2008.  I also had no idea that it now came with autoit.  Yes,  I do see it on my machine and that version I'm guessing is newer then one I've been using since I don't have a www lookup button on mine.

I took that code and added what I felt was missing

I'll have to bookmark this page and come back in a couple days when I have the time.  Outputs as arrays...  that sounds good.  I look forward to that and I'm very curious as what you mean redoing it as a UDF.   Do you mean I'd be able to pull data using your proposed UDF with just a couple lines to reference what I want instead of copying and modifying a couple sections of code from the tool.  If thats what you meant.... Then I eagerly await the future updates

I thought of rewriting it and to do so in a UDF format. That would make the code cleaner and reusable but I have not have the time to do it nor I foresee doing it any time soon. 

.Thanks for the hard work.  I find it tough to go back and update my old code sometimes.  I've found myself wondering how I could have wrote such sloppy code or thinking why did I do it that way when this other way is so much better.    Doing so on someone else's code is just that much harder.

Yes it was and I did not understand how WMI worked back then, so patching it was a way to continue the same look and feel and was never my intention to be the new maintainer of the code but that is what I ended up doing. Otherwise I would have started a new topic instead of hijacking this one.

Also the new format, for what I see, is to distribute the utilities as source. For example AutoIt3Wrapper is no longer an executable, same with SciteConfig, etc. , so I should do a proper rewrite, so that it can be distributed in the same way. Unfortunately is not the case, right now.

The ANSI version that is included in compiled format, is done with a very old version of autoit but is just as functional and my idea was to use that version alone, so it can be used everywhere, from Windows 95 all the way to Windows 10.

Anyway, the code that it generates is a function that returns an array. Then it can be easily included to a script. It also generates a quite long help at the end of the page, along with helper functions. All in all I believe to be an excellent tool, if I say so myself. :)

There are things that are not quite as I'd wanted it. My idea was to make it fully portable, and so on a portable ScITE but that is not the case. Since not many people use it, or complain, I did not push myself to correct that. One of these weekends I may just do it but so far I have'nt.

So for now, use it as is, if you find something wrong with the generated code let me know. If you have a request, I'll add it in the to do list in my head.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • 5 years later...

i just wanted to thank you.

using this tool, i was able to retrieve the current state and last date of the Kaspersky-AV-Virus-Database on my system.
afterwards, to avoid all the loops and holes of all that comerror-handling i took the knowledge to output the wmic-results into a textfile to read.

Local $sIniFile = @TempDir & "\Kaspersky_ProductInfo.ini"

; $FO_OVERWRITE (2) = Write mode (erase previous contents)
; $FO_CREATEPATH (8) = Create directory structure if it does not exist (See Remarks).
; $FO_UNICODE or $FO_UTF16_LE (32) = Use Unicode UTF16 Little Endian reading and writing mode.
Local $hIniFile = FileOpen($sIniFile, 32+2+8)

FileWriteLine($hIniFile, "[Kaspersky]") ; wrote this as an ini header before the wmic-output

; Close File handle to allow STDOUT from WMIC to be appended
FileClose($hIniFile)

RunWait(@ComSpec & " /c " & _
'wmic.exe /namespace:\\root\kaspersky\security path kasperskysecurity_productinfo get * /VALUE >>' & $sIniFile)
; does output as UCS2 LE-BOM therefore created the file with that encoding.

Local $sOutputTxt
$sOutputTxt = ""
$sOutputTxt&= "ConnectionState    " & @TAB & "= " & Iniread($sIniFile, "Kaspersky", "ConnectionState",   "----------") & @CRLF
$sOutputTxt&= "AVBasesDateTime    " & @TAB & "= " & Iniread($sIniFile, "Kaspersky", "AVBasesDatetime",   "----------") & @CRLF
$sOutputTxt&= "IsLicenseInstalled " & @TAB & "= " & Iniread($sIniFile, "Kaspersky", "IsLicenseInstalled","----------") & @CRLF
$sOutputTxt&= "LicenseDaysLeft    " & @TAB & "= " & Iniread($sIniFile, "Kaspersky", "LicenseDaysLeft",   "----------") & @CRLF
$sOutputTxt&= "ProductName        " & @TAB & "= " & Iniread($sIniFile, "Kaspersky", "ProductName",       "----------") & @CRLF
$sOutputTxt&= "ProductVersion     " & @TAB & "= " & Iniread($sIniFile, "Kaspersky", "ProductVersion",    "----------") & @CRLF

msgbox(0,"Date & Time of Database" , $sOutputTxt)

sure - not THAT elegant - but even faster than waiting for the wmi-object to become ready to read. i added the scriptomatic-tool to my permanent tools-list. very handy, cool output alternatives. thank you all for your hard work !

Edited by KnutJ

rsRVpv.gif

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...