Jump to content

Recommended Posts

Posted (edited)

I am not positive I have the most up to date version. I will try again in a short bit.

When I try the "Run" button from the Scriptomatic, it only works when I run Scriptomatic FROM SciTE. When I compile and run it will not work properly. It opens Scriptomatic for a second instance.

Edit: Tried newest version with same results.

BTW Thanks SvenP for such a wonderful script.

Thanks,

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

  • 9 months later...
  • 1 month later...
Posted

On line 450 in the runscript() function it should be this $strCmdLine = @AutoItExe & " /AutoIt3ExecuteScript " & $strTmpName

When ran from scite uncompiled there was no issue but when compiled all that happened was another instance of scriptomatic was launched.

Posted

On line 450 in the runscript() function it should be this $strCmdLine = @AutoItExe & " /AutoIt3ExecuteScript " & $strTmpName

When ran from scite uncompiled there was no issue but when compiled all that happened was another instance of scriptomatic was launched.

Thanks for finding that glitch ChrisL. I've always wondered why AutoITScriptomatic launched multiple times if one instance was open and I tried to launch any other AutoIt script from Scite.

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
  • 3 weeks later...
Posted

Wow this is great THX for this.

I am of use WMI only are to 2 days.

With WMI Code Creator v1.0 from Microsoft.

But the output is *.vbs

Now I can understand it a little bit better... :rolleyes:

  • 1 month later...
Posted

Hiho,

when i try to choose a class i get the following error. Regardless which class a select:

$objClass = $objWMIService.Get($strSelectedClass)

$objClass = $objWMIService.Get($strSelectedClass)^ERROR

Error: The requested action with this object has failed.

I'am using AutoIt 3.2.4.0

As rbhkamal posted i get the same error and don't know how to solve... (got the fixed version)

Some hints for me?

post-6889-1185281165_thumb.jpg

Posted (edited)

Thx for the reply lordofthestrings.

I have no WMI code yet.

I start the app and wait for the WMI namespaces to read out. Then i want to select a wmi class. When i choose one of the 5 classes i see, the app exits with the shown error code....

When i insert a messagebox before the line of error it shows me the right wmi class.

Can you start the script when you compile it with the new autoit release?

Edited by Sundance
Posted

well there you might have your problem...

Some classes in the CIMV2 Namespace require admin rights, are you sure you have this?

you should see about 300 Classes in the list..

I select for example Win32_PROCESS

and I put it in HTML Output..

This works fine for me when I run the code..

; Generated by AutoIt Scriptomatic

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output = $Output & '<html><head><title>Scriptomatic HTML Output</title></head><body> <style>table {font-size: 10pt; font-family: arial;} th {background-color: buttonface; font-decoration: bold;} </style><table BORDER="1"><tr><th>Property</th><th>Value</th></tr>'
$Output = $Output & '<tr bgcolor="yellow"><td>' & "Computer</td><td>&nbsp;" & $strComputer  & "</td></tr>" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Process", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $Output & "<tr><td>Caption</td><td>&nbsp;" & $objItem.Caption & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>CommandLine</td><td>&nbsp;" & $objItem.CommandLine & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>CreationClassName</td><td>&nbsp;" & $objItem.CreationClassName & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>CreationDate</td><td>&nbsp;" & WMIDateStringToDate($objItem.CreationDate) & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>CSCreationClassName</td><td>&nbsp;" & $objItem.CSCreationClassName & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>CSName</td><td>&nbsp;" & $objItem.CSName & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>Description</td><td>&nbsp;" & $objItem.Description & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>ExecutablePath</td><td>&nbsp;" & $objItem.ExecutablePath & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>ExecutionState</td><td>&nbsp;" & $objItem.ExecutionState & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>Handle</td><td>&nbsp;" & $objItem.Handle & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>HandleCount</td><td>&nbsp;" & $objItem.HandleCount & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>InstallDate</td><td>&nbsp;" & WMIDateStringToDate($objItem.InstallDate) & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>KernelModeTime</td><td>&nbsp;" & $objItem.KernelModeTime & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>MaximumWorkingSetSize</td><td>&nbsp;" & $objItem.MaximumWorkingSetSize & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>MinimumWorkingSetSize</td><td>&nbsp;" & $objItem.MinimumWorkingSetSize & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>Name</td><td>&nbsp;" & $objItem.Name & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>OSCreationClassName</td><td>&nbsp;" & $objItem.OSCreationClassName & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>OSName</td><td>&nbsp;" & $objItem.OSName & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>OtherOperationCount</td><td>&nbsp;" & $objItem.OtherOperationCount & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>OtherTransferCount</td><td>&nbsp;" & $objItem.OtherTransferCount & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>PageFaults</td><td>&nbsp;" & $objItem.PageFaults & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>PageFileUsage</td><td>&nbsp;" & $objItem.PageFileUsage & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>ParentProcessId</td><td>&nbsp;" & $objItem.ParentProcessId & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>PeakPageFileUsage</td><td>&nbsp;" & $objItem.PeakPageFileUsage & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>PeakVirtualSize</td><td>&nbsp;" & $objItem.PeakVirtualSize & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>PeakWorkingSetSize</td><td>&nbsp;" & $objItem.PeakWorkingSetSize & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>Priority</td><td>&nbsp;" & $objItem.Priority & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>PrivatePageCount</td><td>&nbsp;" & $objItem.PrivatePageCount & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>ProcessId</td><td>&nbsp;" & $objItem.ProcessId & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>QuotaNonPagedPoolUsage</td><td>&nbsp;" & $objItem.QuotaNonPagedPoolUsage & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>QuotaPagedPoolUsage</td><td>&nbsp;" & $objItem.QuotaPagedPoolUsage & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>QuotaPeakNonPagedPoolUsage</td><td>&nbsp;" & $objItem.QuotaPeakNonPagedPoolUsage & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>QuotaPeakPagedPoolUsage</td><td>&nbsp;" & $objItem.QuotaPeakPagedPoolUsage & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>ReadOperationCount</td><td>&nbsp;" & $objItem.ReadOperationCount & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>ReadTransferCount</td><td>&nbsp;" & $objItem.ReadTransferCount & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>SessionId</td><td>&nbsp;" & $objItem.SessionId & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>Status</td><td>&nbsp;" & $objItem.Status & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>TerminationDate</td><td>&nbsp;" & WMIDateStringToDate($objItem.TerminationDate) & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>ThreadCount</td><td>&nbsp;" & $objItem.ThreadCount & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>UserModeTime</td><td>&nbsp;" & $objItem.UserModeTime & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>VirtualSize</td><td>&nbsp;" & $objItem.VirtualSize & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>WindowsVersion</td><td>&nbsp;" & $objItem.WindowsVersion & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>WorkingSetSize</td><td>&nbsp;" & $objItem.WorkingSetSize & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>WriteOperationCount</td><td>&nbsp;" & $objItem.WriteOperationCount & "</td></tr>" & @CRLF
      $Output = $Output & "<tr><td>WriteTransferCount</td><td>&nbsp;" & $objItem.WriteTransferCount & "</td></tr>" & @CRLF
   Next
   FileWrite(@TempDir & "\Win32_Process.HTML", $Output )
   Run(@Comspec & " /c start " & @TempDir & "\Win32_Process.HTML" )
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Process" )
Endif


Func WMIDateStringToDate($dtmDate)

    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc
Posted

Hi,

i have a very funny behaviour of scriptomatic. When i select root\CIMV2, scriptomatic show me 5 WMI classes. When i select the same Namespace (root\CIMV2) under WMI Code Creator it shows me 406 classes.

When i select root\DEFAULT under WMI Code Creator i get those 5 classes. There seems to be a little problem with scriptomatic to get the class(-names) right.

On this machine i have admin rights, this can't be the problem. I've tried the same thing on a different machine with the same result.

All machines are in a domain. But there are no known policies which harm the wmi service. Other WMI tools are working as they should...

Posted (edited)

I will additionally try scriptomatic at home. Seeing if it runs there and try to find out where is the difference....

PS: i run the autoitscript you posted and it runs without any prob.

at line 332

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @COMPUTERNAME & $g_strCurrentNamespace)

then i select the \root\default namespace and the class Win32_Process.

This works! I get the autoitscript. Very funny...

Edited by Sundance
  • 2 months later...
  • 7 months later...
  • 1 month later...
  • 2 weeks later...
Posted

Thanks for this nice script its helps a lot. muttley

after autoit 3.2.12 you must include

#include <WindowsConstants.au3>

Thanks Paulchen

  • 1 month later...
  • 2 months later...
Posted

Hey SvenP,

what about changing scriptomatic so correct wmi-code for accessing remote hosts is generated? If a hostname is entered...

$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\ROOT\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)oÝ÷ ÚÈhºW©àzÚºÚ"µÍÌÍÜÝÛÛ]H ][ÝÜ[[ÝZÜÝ ][ÝÂÌÍÕÙH ][ÝÕÙ][ÝÂÌÍÔÜÝÛÜH   ][ÝÔÜÝÛÜ  ][ÝÂÌÍÛØÕØ[SØØ]ÜHØÜX]J ][ÝÕØ[TØÜ[ËÕØ[SØØ]Ü][ÝÊBÌÍÛØÓRTÙXÙHH    ÌÍÛØÕØ[SØØ]ÜÛÛXÝÙ  ÌÍÜÝÛÛ]   ][ÝÜÛÝ  ÌLÐÒSU][ÝË ÌÍÕÙ    ÌÍÔÜÝÛÜ
BÌÍØÛÛ][ÈH    ÌÍÛØÓRTÙXÙK^XÔ]YJ   ][ÝÔÑSPÕ
ÓHÚ[ÌÔØÙÜÛÜ][ÝË  ][ÝÕÔS   ][ÝË  ÌÍÝØ[QYÔ][[YYX][H
È  ÌÍÝØ[QYÑÜØÛJ

Right?

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
  • Recently Browsing   0 members

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