?
Solved

connecting to remote server chosen dynamically

Posted on 2006-04-28
2
Medium Priority
?
195 Views
Last Modified: 2010-04-23
Hi
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!

Thanks

0
Comment
Question by:LuckyLucks
2 Comments
 

Author Comment

by:LuckyLucks
ID: 16563318
I meant ManagementScop not ManagemantPath, typo!
0
 
LVL 34

Accepted Solution

by:
Sancler earned 2000 total points
ID: 16564002
Yes you can.  See here

http://msdn2.microsoft.com/en-us/library/w7sx1w4f.aspx

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

Roger

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

864 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