Windows Vista Forums

tools
  1. #1


    phoenix Guest

    tools

    If I take the following script.

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set IPConfigSet = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration Where
    IPEnabled=TRUE")

    For Each IPConfig in IPConfigSet
    If Not IsNull(IPConfig.IPAddress) Then
    For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
    WScript.Echo IPConfig.IPAddress(i)
    Next
    End If
    Next





    I am using Windows Management Instrument, how can I trace where this is
    and what all the available other options are.

    Are there any better tools ?

      My System SpecsSystem Spec

  2. #2


    Pegasus \(MVP\) Guest

    Re: tools


    "phoenix" <phoenix@xxxxxx> wrote in message
    news:OTInp9oMJHA.5692@xxxxxx

    > If I take the following script.
    >
    > strComputer = "."
    > Set objWMIService = GetObject("winmgmts:" _
    > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    >
    > Set IPConfigSet = objWMIService.ExecQuery _
    > ("Select * from Win32_NetworkAdapterConfiguration Where
    > IPEnabled=TRUE")
    >
    > For Each IPConfig in IPConfigSet
    > If Not IsNull(IPConfig.IPAddress) Then
    > For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
    > WScript.Echo IPConfig.IPAddress(i)
    > Next
    > End If
    > Next
    >
    >
    >
    > I am using Windows Management Instrument, how can I trace where this is
    > and what all the available other options are.
    >
    > Are there any better tools ?
    Try WMI Code Creator:
    http://www.microsoft.com/downloads/d...displaylang=en



      My System SpecsSystem Spec

  3. #3


    phoenix Guest

    Re: tools

    Fantastic tool.. thank you very much.

    Is there something similar with Active Directory ? Or am I pushing my
    luck ..





    Pegasus (MVP) wrote:

    > "phoenix" <phoenix@xxxxxx> wrote in message
    > news:OTInp9oMJHA.5692@xxxxxx

    >> If I take the following script.
    >>
    >> strComputer = "."
    >> Set objWMIService = GetObject("winmgmts:" _
    >> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    >>
    >> Set IPConfigSet = objWMIService.ExecQuery _
    >> ("Select * from Win32_NetworkAdapterConfiguration Where
    >> IPEnabled=TRUE")
    >>
    >> For Each IPConfig in IPConfigSet
    >> If Not IsNull(IPConfig.IPAddress) Then
    >> For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
    >> WScript.Echo IPConfig.IPAddress(i)
    >> Next
    >> End If
    >> Next
    >>
    >>
    >>
    >> I am using Windows Management Instrument, how can I trace where this is
    >> and what all the available other options are.
    >>
    >> Are there any better tools ?
    >
    > Try WMI Code Creator:
    > http://www.microsoft.com/downloads/d...displaylang=en
    >
    >

      My System SpecsSystem Spec

  4. #4


    phoenix Guest

    Re: tools

    Can anyone explain the following:

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set a = fso.CreateTextFile("c:\testfile.txt", True)
    a.WriteLine("This is a test.")
    a.Close



    I get the code.. just that where do I find the FileSystemObject and
    others like it? I've been using WMI and looking in root/CIMV2.

    Please give me a quick difference between the two types.

    Cheers,

      My System SpecsSystem Spec

  5. #5


    Richard Mueller [MVP] Guest

    Re: tools


    "phoenix" <phoenix@xxxxxx> wrote in message
    news:OgRX1crMJHA.4248@xxxxxx

    > Can anyone explain the following:
    >
    > Set fso = CreateObject("Scripting.FileSystemObject")
    > Set a = fso.CreateTextFile("c:\testfile.txt", True)
    > a.WriteLine("This is a test.")
    > a.Close
    >
    >
    >
    > I get the code.. just that where do I find the FileSystemObject and
    > others like it? I've been using WMI and looking in root/CIMV2.
    >
    > Please give me a quick difference between the two types.
    >
    > Cheers,
    The snippet you gave uses the FileSystemObject. This is available in every
    Microsoft operating system since Windows 95. (You must install DSClient on
    Win9x and NT clients). I believe it is implemented in vbscript.dll. It has
    nothing to do with WMI.

    WMI comes with every operating system since Windows 2000, but it can be
    installed on older clients. The best resource I know of to learn how to use
    WMI and the FileSystemObject is "Microsoft Windows 2000 Scripting Guide":

    http://www.microsoft.com/technet/scr....mspx?mfr=true

    Introduction to WMI:

    http://www.microsoft.com/technet/scr..._overview.mspx

    Chapters on dealing with files and disks are linked here:

    http://www.microsoft.com/technet/scr..._overview.mspx

    Many examples in the Scripting Center. For example:

    http://www.microsoft.com/technet/scr...e/default.mspx

    The classes available in WMI depend a bit on the OS. I think the links above
    include a way to "discover" which classes are available, but I look for
    example code in the Script Center.

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --



      My System SpecsSystem Spec

  6. #6


    mayayana Guest

    Re: tools

    That's a big question. First, WMI has nothing to
    do with VBScript directly. It's a complete system
    on it's own, with its own objects and syntax. WMI
    just happens to be one tool that is accessible through
    VBScript. If you don't have a copy of the WMI help
    file you should try to find that. There used to be a
    WMI SDK that could be downloaded, with samples and
    a good help file. Looking around now I'm finding the
    typical problem with getting Microsoft docs: The links
    to the SDK are broken. Mentions of it only point to
    the "download center", which is a generic MS download
    page. A search there turned up nothing.

    It may be that the WMI SDK, like some others, is now
    only available as part of the giant Win32 platform SDK.
    That presents some problems. First, you'll need a high
    speed connection to get it. Then you probably have to
    allow the install of Microsoft's "Windows Genuine Advantage"
    spyware. Worse, MS created a new, incompatible help system
    in their recent SDKs. I think they call it HTML Help 2. One
    apparently needs Visual Studio 2008 to read the new help.
    There's a free program called HelpExplorer that also seems to
    work, but HelpExplorer can't provide a master index to the
    large number of help files in the platform SDK.

    The original help file, if you can find it, will be named
    wmisdk.chm.

    There's also a WMI group:
    microsoft.public.win32programmer.wmi

    What you posted is VBScript using the FileSystemObject,
    which is one of the many COM objects available to script.
    There isn't really a master list of those. There are a handful
    that are officially part of the Windows Script Host, such
    as FSO, Dictionary, WScript.Shell, etc. Those objects are
    in scrrun.dll and wshom.ocx. You can inspect those files with
    an object browser. A free object browser is here:
    http://www.tlviewer.org/tlviewer/

    To make a long story very short, COM objects are specifically
    designed programming tools that are registered in the Registry.
    Any number of objects can reside in a given PE file (exe, dll, ocx).
    Part of the COM spec. is that these files also have a "type library" --
    either internal or in an external file -- which describes the methods
    and properties of objects. The type library makes a COM object
    "self-describing". An object browser is basically a specialized
    type library reader that allows you to see what objects are avaiaable
    and what their methods are. (Though an object browser rarely
    provides enough information to use an object. It's mostly sort
    of a crib sheet for reference.)

    In VBScript, using the CreateObject method, you can use
    many of the COM objects registered on your system, thereby
    expanding the abilities of VBS. Such objects are not inherent
    to VBS itself. The object must be installed/registered on your
    system in order to use it.

    For the basic objects connected with WSH, like FSO, you
    can look up the methods in the WSH help file. Then there are
    objects like Shell.Application that are on nearly all Windows
    systems (Shell.App. was added with Active Desktop/Win98), but
    they're not official scripting objects so they're not in the help file.
    Then there are automation objects, like Internet Explorer and
    MS Word. You can use VBS with them. There are also various
    3rd-party (non-Microsoft) components available.

    So most of what VBS can do is derived from one object or
    another, but objects can be all sorts of things.


    > Can anyone explain the following:
    >
    > Set fso = CreateObject("Scripting.FileSystemObject")
    > Set a = fso.CreateTextFile("c:\testfile.txt", True)
    > a.WriteLine("This is a test.")
    > a.Close
    >
    >
    >
    > I get the code.. just that where do I find the FileSystemObject and
    > others like it? I've been using WMI and looking in root/CIMV2.
    >
    > Please give me a quick difference between the two types.
    >




      My System SpecsSystem Spec

  7. #7


    mayayana Guest

    Re: tools

    >

    > The snippet you gave uses the FileSystemObject. This is available in every
    > Microsoft operating system since Windows 95. (You must install DSClient on
    > Win9x and NT clients). I believe it is implemented in vbscript.dll
    It's actually in scrrun.dll and comes with the WSH,
    which is optional on Win98 and an extra install on
    Win95. It can also be removed, though.There seems
    to be a percentage of system admins who regard
    WSH as a big securtiy risk and like to remove/disable it.

    Scrrun.dll is also redistributable, so it could be added/
    updated on a target system regardless of the WSH
    status of that system.

    (Then there are the security issues connected with
    ..VBS. Many AV products will allow an unknown EXE to
    run without problem but will sound the alarm -- or even
    block execution -- when a .vbs file is run that's using
    FSO. That's not really a limitation with FSO but it's a
    realistic limitation in terms of how much confidence one can
    have in distributing scripts.)



      My System SpecsSystem Spec

  8. #8


    Pegasus \(MVP\) Guest

    Re: tools


    "phoenix" <phoenix@xxxxxx> wrote in message
    news:OgRX1crMJHA.4248@xxxxxx

    > Can anyone explain the following:
    >
    > Set fso = CreateObject("Scripting.FileSystemObject")
    > Set a = fso.CreateTextFile("c:\testfile.txt", True)
    > a.WriteLine("This is a test.")
    > a.Close
    >
    >
    >
    > I get the code.. just that where do I find the FileSystemObject and
    > others like it? I've been using WMI and looking in root/CIMV2.
    >
    > Please give me a quick difference between the two types.
    >
    > Cheers,
    You'll find all the basic VB Scripting objects (including the File System
    Object) explained in the downloadable file script56.chm.



      My System SpecsSystem Spec

  9. #9


    Paul Randall Guest

    Re: tools

    Perhaps you could try searching msdn.com for the two words:
    adsi matic

    -Paul Randall

    "phoenix" <phoenix@xxxxxx> wrote in message
    news:uNEhFupMJHA.260@xxxxxx

    > Fantastic tool.. thank you very much.
    >
    > Is there something similar with Active Directory ? Or am I pushing my
    > luck ..
    >
    >
    >
    >
    >
    > Pegasus (MVP) wrote:

    >> "phoenix" <phoenix@xxxxxx> wrote in message
    >> news:OTInp9oMJHA.5692@xxxxxx

    >>> If I take the following script.
    >>>
    >>> strComputer = "."
    >>> Set objWMIService = GetObject("winmgmts:" _
    >>> & "{impersonationLevel=impersonate}!\\" & strComputer &
    >>> "\root\cimv2")
    >>>
    >>> Set IPConfigSet = objWMIService.ExecQuery _
    >>> ("Select * from Win32_NetworkAdapterConfiguration Where
    >>> IPEnabled=TRUE")
    >>>
    >>> For Each IPConfig in IPConfigSet
    >>> If Not IsNull(IPConfig.IPAddress) Then
    >>> For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
    >>> WScript.Echo IPConfig.IPAddress(i)
    >>> Next
    >>> End If
    >>> Next
    >>>
    >>>
    >>>
    >>> I am using Windows Management Instrument, how can I trace where this is
    >>> and what all the available other options are.
    >>>
    >>> Are there any better tools ?
    >>
    >> Try WMI Code Creator:
    >> http://www.microsoft.com/downloads/d...displaylang=en


      My System SpecsSystem Spec

tools problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Solved tools bobkupferer General Discussion 5 16 Feb 2010
PRO TOOLS and 64 bit markod Software 0 16 Aug 2009
system tools elvira Vista performance & maintenance 1 08 Apr 2007
Can't move Administrative Tools to System Tools? Noozer Vista installation & setup 4 17 Oct 2006
Mandatory Integrity Control (MIC) tools? Biba tools? Sharon2323 Vista security 1 04 Aug 2006