Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i want msedgewebview2 process ID..
#9
Hello Wil,

If you want, you can play with my WMI test code.
Regards,

Bernard.
Code:
' WMI.vbs
' Script to evaluate the Windows WMI ( CIM and Win32 classes ).
'
' This code is a basic sample.
'
' https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/cimwin32-wmi-providers
' https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-provider

option explicit

bv_LoadWithCScript()

' Parameter : active a class to edit ( not all class arent in this code ).

'Const classe = "CIM_Chassis"                         ' ok.
'Const classe = "CIM_Chip"                            ' ok.
'Const classe = "CIM_DesktopMonitor"                  ' ok.
'Const classe = "CIM_DMA"                             ' ok.
'Const classe = "CIM_Display"                         ' ok.
'Const classe = "CIM_LogicalDevice"                   ' ok.
'Const classe = "CIM_Memory"                          ' ok.
'Const classe = "CIM_MemoryCapacity"                  ' ok.
'Const classe = "CIM_MemoryCheck"                     ' ok.
'Const classe = "CIM_MemoryMappedIO"                  ' ok.
'Const classe = "CIM_MemoryOnCard"                    ' ok.
'Const classe = "CIM_NonVolatileStorage"              ' ok.
'Const classe = "CIM_OSVersionCheck"                  ' ok.
'Const classe = "CIM_PhysicalMedia"                   ' ok.
'Const classe = "CIM_PhysicalElement"                 ' ok.
'Const classe = "CIM_PhysicalMemory"                  ' ok.
'Const classe = "CIM_Process"                         ' ok.
'Const classe = "CIM_Processor"                       ' ok.
'Const classe = "CIM_Product"                         ' ok.
'Const classe = "CIM_Setting"                         ' Error on << nItems = Items.count >>.
'Const classe = "CIM_Thread"                          ' ok.
'Const classe = "CIM_USBDevice"                       ' ok.
'Const classe = "CIM_VideoController"                 ' ok.

'Const classe = "Win32_1394Controller"                ' ok.
'Const classe = "Win32_1394ControllerDevice"          ' ok.
'Const classe = "Win32_AutochkSetting"                ' ok.
'Const classe = "Win32_BaseBoard"                     ' ok.
'Const classe = "Win32_Battery"                       ' ok.
'Const classe = "Win32_BIOS"                          ' ok.
'Const classe = "Win32_Bus"                           ' ok.
'Const classe = "Win32_CacheMemory"                   ' ok.
'Const classe = "Win32_CDROMDrive"                    ' ok.
'Const classe = "Win32_CIMLogicalDeviceCIMDataFile"   ' ok.
'Const classe = "Win32_ComputerSystem"                ' Maybe a default : loop always.
'Const classe = "Win32_CurrentProbe"                  ' ok.
'Const classe = "Win32_DesktopMonitor"                ' ok.
'Const classe = "Win32_DeviceChangeEvent"             ' ok.
'Const classe = "Win32_DeviceMemoryAddress"           ' ok.
'Const classe = "Win32_Directory"                     ' ok, long time.
'Const classe = "Win32_DiskDrive"                     ' ok.
'Const classe = "Win32_DiskPartition"                 ' ok.
'Const classe = "Win32_DisplayControllerConfiguration" ' ok.
'Const classe = "Win32_DMAChannel"                    ' ok.
'Const classe = "Win32_SystemEnclosure"               ' ok.
'Const classe = "Win32_Fan"                           ' ok.
'Const classe = "Win32_FloppyController"              ' ok.
'Const classe = "Win32_FloppyDrive"                   ' ok.
'Const classe = "Win32_HeatPipe"                      ' ok.
'Const classe = "Win32_IDEController"                 ' ok.
'Const classe = "Win32_IDEControllerDevice"           ' ok.
'Const classe = "Win32_InfraredDevice"                ' ok.
'Const classe = "Win32_IRQResource"                   ' ok.
'Const classe = "Win32_Keyboard"                      ' ok.
'Const classe = "Win32_LogicalDisk"                   ' ok.
'Const classe = "Win32_MotherboardDevice"             ' ok.
'Const classe = "Win32_NetworkAdapter"                ' ok.
'Const classe = "Win32_NetworkAdapterSetting"         ' ok.
'Const classe = "Win32_NetworkAdapterConfiguration"   ' ok.
'Const classe = "Win32_NetworkClient"                 ' ok.
'Const classe = "Win32_NetworkConnection"             ' ok.
'Const classe = "Win32_NetworkLoginProfile"           ' ok.
'Const classe = "Win32_NetworkProtocol"               ' ok.
'Const classe = "Win32_NTEventLogFile"                ' ok.
'Const classe = "Win32_NTLogEvent"                    ' ok, long time.
'Const classe = "Win32_NTLogEventLog"                 ' Long time.
'Const classe = "Win32_NTLogEventComputer"            ' Long time.
'Const classe = "Win32_NTLogEventUser"                ' Long time.
'Const classe = "Win32_OperatingSystem"               ' ok.
'Const classe = "Win32_PerfFormattedData_TCPIP_NetworkInterface" ' ok.
Const classe = "Win32_Printer"                       ' ok.
'Const classe = "Win32_PrinterDriver"                 ' ok.
'Const classe = "Win32_Process"                       ' ok.
'Const classe = "Win32_Processor"                     ' ok.
'Const classe = "Win32_Refrigeration"                 ' ok.
'Const classe = "Win32_Service"                       ' ok.
'Const classe = "Win32_TemperatureProbe"              ' ok.
'Const classe = "Win32_UserAccount"                   ' ok.

Const ForWriting   =  2
Const TristateTrue = -1

Public pu_cOut : pu_cOut  = bv_DirBase() & "\_Result.txt" ' TXT output file created.

Dim a
Dim cLine
Dim cType
Dim i
Dim Item
Dim Items
Dim Method
Dim n
Dim nItems
Dim oFile
Dim oFso
Dim oLocator
Dim oWMI
Dim Propertie

bv_fErase( pu_cOut )

Set oFso  = CreateObject( "Scripting.FileSystemObject" )
Set oFile = oFso.OpenTextFile( pu_cOut, ForWriting, True, TristateTrue )

QOutWrite "WMI class selected : " & classe, oFile
QOutWrite "", oFile

Set oLocator  = CreateObject( "WbemScripting.SWbemLocator" )
Set oWMI      = oLocator.ConnectServer( ".", "root\cimv2" )
Set Items     = oWMI.ExecQuery( "Select * from " & classe )

nItems = Items.count
QOutWrite "Items count : " & CStr( nItems ), oFile
QOutWrite "", oFile

If nItems < 1 Then
   QOutWrite "No item for class : " & classe, oFile
Else
   i = 0
   For Each Item in Items
      i = i + 1
      ' Write the method(s).
      If i = 1 Then
         QOutWrite "Method(s) : " & Cstr( Item.Methods_.Count ), oFile
         QOutWrite "", oFile
         For Each Method in Item.Methods_
            QOutWrite Method.Name & "()", oFile
         Next
         QOutWrite "", oFile
      End If
      bv_QOut( "Item " & Cstr( i ) & " / " & Cstr( nItems ) )
      oFile.WriteLine( String( 70, "-" ) & " " + CStr( i ) & " / " & Cstr( nItems ) )
      oFile.WriteLine( "" )
      ' Get the max lenght of the properties names.
      n = 1
      For Each Propertie in Item.Properties_
         If Len( Propertie.Name ) > n Then
            n = Len( Propertie.Name )
         End If
      Next
      n = n + 1
      ' Write the properties.
      For Each Propertie in Item.Properties_
         cType = TypeName( Propertie.Value )
         cLine = bv_Padr( cType, 11, " " ) & "- "
         cLine = cLine & bv_Padr( Propertie.Name, n, "." ) & " "
         If cType = "String" Then
            cLine = cLine & Propertie.Value
         ElseIf cType = "Null" Then
            cLine = cLine
         ElseIf cType = "Variant()" Then
            cLine = cLine & "Array( " & CStr( UBound( Propertie.Value ) ) & " )" & vbCrLf
            For a = LBound( Propertie.Value ) to UBound( Propertie.Value ) Step 1
               cType = TypeName( Propertie.Value( a ) )
               cLine = cLine & bv_Padl( Cstr( a ), 10, " " ) & " . "
               cLine = cLine & bv_Padr( cType, 11, " " ) & ". "
               If cType = "String" Then
                  cLine = cLine & Propertie.Value( a )
               ElseIf cType = "Null" Then
                  cLine = cLine
               ElseIf cType = "Variant()" Then
                  cLine = cLine & "Array( " & CStr( UBound( Propertie.Value( a ) ) ) & " )"
               Else
                  cLine = cLine & CStr( Propertie.Value( a ) )
               End If
               If a < UBound( Propertie.Value ) Then
                  cLine = cLine & vbCrLf
               End If
            Next
         Else
            cLine = cLine & CStr( Propertie.Value )
         End If
         oFile.WriteLine( cLine )
      Next
      oFile.WriteLine( "" )
   Next
End If

oFile.Close

Set oFile     = Nothing
Set oFso      = Nothing
Set Item      = Nothing
Set Propertie = Nothing
Set Method    = Nothing
Set oLocator  = Nothing
Set Items     = Nothing
Set oWMI      = Nothing

bv_Run pu_cOut, 1, False

bv_Wait()

WScript.Quit

' ***** Used tools *****

' Get the default directory.
Function bv_DirBase()
   bv_DirBase = Left( WScript.ScriptFullName, InStrRev( WScript.ScriptFullName, "\" ) )
End Function

' Erase a file.
Sub bv_fErase( cFile_bv )
   Dim oFso_bv
   Set oFso_bv = CreateObject( "Scripting.FileSystemObject" )
   If oFso_bv.FileExists( cFile_bv ) Then
      oFso_bv.DeleteFile cFile_bv
   End If
   Set oFso_bv = Nothing
End Sub

' Load with CScript if the script is loaded with VBScript to look the console.
Sub bv_LoadWithCScript()
   If InStr( LCase( WScript.FullName ), "cscript.exe" ) = 0 Then
      CreateObject( "WScript.Shell" ).Run "cscript.exe //NoLogo """ & WScript.ScriptFullName & ""
      WScript.Quit
   End If
End Sub

' Add character(s) at left of a string.
Function bv_Padl( cString_bv, nChars_bv, cChar_bv )
   bv_Padl = String( nChars_bv - Len( cString_bv ), cChar_bv ) & cString_bv
End Function

' Add character(s) at right of a string.
Function bv_Padr( cString_bv, nChars_bv, cChar_bv )
   bv_Padr = cString_bv & String( nChars_bv - Len( cString_bv ), cChar_bv )
End Function

' Write a line in the console.
Sub bv_QOut( cString_bv )
   WScript.StdOut.WriteLine cString_bv
End Sub

' Write a line in the console and in a file.
Sub QOutWrite( cString_bv, oFile_bv )
   WScript.StdOut.WriteLine cString_bv
   oFile_bv.WriteLine( cString_bv )
End Sub

' Run with options.
Sub bv_Run( cRun_bv, cDisplay_bv, lStop_bv )
   CreateObject( "WScript.Shell" ).Run cRun_bv, cDisplay_bv, lStop_bv
End Sub

' Wait and exit with press << Enter >>.
Sub bv_Wait()
   Dim cString_bv
   WScript.StdOut.WriteLine ""
   WScript.StdOut.Write "Press << Enter >> to exit"
   cString_bv = WScript.StdIn.ReadLine
End Sub
Reply


Messages In This Thread
i want msedgewebview2 process ID.. - by hys999 - 2023-02-10, 12:17:20
RE: i want msedgewebview2 process ID.. - by wila - 2023-02-11, 18:22:42
RE: i want msedgewebview2 process ID.. - by wila - 2023-02-11, 19:29:22
RE: i want msedgewebview2 process ID.. - by wila - 2023-02-11, 20:09:03
RE: i want msedgewebview2 process ID.. - by Bernard Mouille - 2023-02-13, 12:56:30
RE: i want msedgewebview2 process ID.. - by wila - 2023-02-13, 13:21:41
RE: i want msedgewebview2 process ID.. - by wila - 2023-02-23, 21:22:08
RE: i want msedgewebview2 process ID.. - by wila - 2023-03-14, 20:57:50
RE: i want msedgewebview2 process ID.. - by wila - 2023-03-15, 11:07:00
RE: i want msedgewebview2 process ID.. - by wila - 2023-03-15, 13:58:01
RE: i want msedgewebview2 process ID.. - by wila - 2023-03-15, 14:21:55
RE: i want msedgewebview2 process ID.. - by wila - 2023-03-16, 00:00:02
RE: i want msedgewebview2 process ID.. - by wila - 2023-03-16, 22:50:25
RE: i want msedgewebview2 process ID.. - by wila - 2023-03-17, 15:57:22

Forum Jump:


Users browsing this thread: 1 Guest(s)