Windows Management

 Introduction

 VBScript Collection (1)
 VBScript Collection (2)
 WSH (Scripting Host)

 WMI

 ADSI

 PowerShell

 Resource Kit (2003)

 Resource Kit (2000)

 Resource Kit (NT4)

 Miscellaneous


ActiveXperts
Network Monitor


 Product Overview

 Built-in checks:
 
 Brochure (.pdf)

 Manual (.pdf)

 Download (.exe)


Some quotes

 
 Windows&.NET Mag.:
 "Small,smart,handy!"
 
 "Extremely easy to use,
  great value for money!"



  ActiveXperts Network Monitor - Home page
  Download ActiveXperts Network Monitor 7.1  (7327 KB - .exe file)

WMI Samples - Connect to remote WMI computers

List all shares on local computer using credentials of currently logged on user
List all shares on local or remote computer using credentials of currently logged on user
Impersonation sample: List all shares on a remote computer using different credentials than logged on user




List all shares on local computer using credentials of currently logged on user

Option Explicit

ListShares()
WScript.Echo vbCrlf & "Ready."

Sub ListShares()
    Dim strObject
    Dim colShares
    Dim objWMIService, objShare

    Set objWMIService = GetObject( "winmgmts:" )
    Set colShares = objWMIService.ExecQuery( "Select * from Win32_Share" )
    For Each objShare In colShares
        Wscript.Echo objShare.Name & " [" & objShare.Path & "]"
    Next
End Sub


List all shares on local or remote computer using credentials of currently logged on user

Option Explicit

Dim strComputer
Do
    strComputer = inputbox( "Please enter name of a computer (or . for local host)", "Input" )
Loop until strComputer <> ""
ListShares( strComputer )
WScript.Echo vbCrlf & "Ready."

Sub ListShares(  strComputer )
    Dim strObject
    Dim colShares
    Dim objWMIService, objShare

    Set objWMIService = GetObject( "winmgmts://" & strComputer & "/root/cimv2" )
    Set colShares = objWMIService.ExecQuery( "Select * from Win32_Share" )
    For Each objShare In colShares
        Wscript.Echo objShare.Name & " [" & objShare.Path & "]"
    Next
End Sub

Impersonation sample: List all shares on a remote computer using different credentials than logged on user

Option Explicit

Dim strComputer, strUser, strPassword
Do
    strComputer = inputbox( "Please enter computername (or . for local host)", "Input" )
Loop until strComputer <> ""
Do
    strUser = inputbox( "Please enter username", "Input" )
Loop until strUser <> ""
Do
    strPassword = inputbox( "Please enter password", "Input" )
Loop until strPassword <> ""
ListShares strComputer, strUser, strPassword

WScript.Echo vbCrlf & "Ready."


Sub ListShares(  strComputer, strUser, strPassword )
    Dim strObject
    Dim objLocator, objWMIService, objShare
    Dim colShares

    Set objLocator = CreateObject( "WbemScripting.SWbemLocator" )
    Set objWMIService = objLocator.ConnectServer ( strComputer, "root/cimv2", strUser, strPassword )
    objWMIService.Security_.impersonationlevel = 3
    Set colShares = objWMIService.ExecQuery( "Select * from Win32_Share" )
        For Each objShare In colShares
            Wscript.Echo objShare.Name & " [" & objShare.Path & "]"
    Next
End Sub

©2009 ActiveXperts Software B.V. All rights reserved.  Contact Us | Terms of Use | Privacy Policy