Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery( _
"select * from win32_process" )
For Each objProcess in colProcesses
If objProcess.GetOwner ( User, Domain ) = 0 Then
Wscript.Echo "Process " & _
objProcess.Caption & _
" belongs to " & Domain & _
"\" & User
Else
Wscript.Echo "Problem " & Rtn & _
" getting the owner for process " _
& objProcess.Caption
End If
Next
Option Explicit
Private Declare Function OpenSCManager Lib "advapi32.dll" Alias "OpenSCManagerA" (ByVal lpMachineName As String, ByVal lpDatabaseName As String, ByVal dwDesiredAccess As Long) As Long
Private Declare Function CloseServiceHandle Lib "advapi32.dll" (ByVal hSCObject As Long) As Long
Private Const SC_MANAGER_ENUMERATE_SERVICE = &H4
Private Sub Form_Load()
Dim strMachine As String
Dim strDatabase As String
Dim lRet As Long
'Try with an empty string first
'strMachine = "COMPNAME" ' leave this empty to connect to the local computer
lRet = OpenSCManager(strMachine, strDatabase, SC_MANAGER_ENUMERATE_SERVICE)
If lRet <> 0 Then
'you connected so close the handle
CloseServiceHandle lRet
Else
'call did not work
MsgBox "Call failed"
End If
End Sub