connecting to remote server chosen dynamically

Posted on 2006-04-28
Last Modified: 2010-04-23
I am trying to coonect to a remote server from a local machine and all is working well.

However when I try to change the server name dynamically (user input) i.e instead of setting a hardcoded servername, I get an error saying you cant use a string for the System.Manageement.ManagementPath

dim dynamichost as string ="\\" & inputservername & "\root" & "\cimv2"
 Dim oMs As New System.Management.ManagementScope(dynamichost, oConn)

It would work if I did Dim oMs As New System.Management.ManagementScope("\\Server100\root\cimv2", oConn)

Please advise as to how I can get around to setting my servername dynamically!


Question by:LuckyLucks

    Author Comment

    I meant ManagementScop not ManagemantPath, typo!
    LVL 34

    Accepted Solution

    Yes you can.  See here

    And your code works for me: in the sense of getting no errors when editing or when compiling.  Is something else going on?



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    I'm currently working for a company where I have to upgrade over 50 VB6 programs to VB.NET 2008.  So far I'm about half way through, and I've learned quite a few tricks that drastically improve the performance of VB.NET apps. Because there are a…
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now