Link to home
Start Free TrialLog in
Avatar of LuckyLucks
LuckyLucks

asked on

connecting to remote server chosen dynamically

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

Avatar of LuckyLucks
LuckyLucks

ASKER

I meant ManagementScop not ManagemantPath, typo!
ASKER CERTIFIED SOLUTION
Avatar of Sancler
Sancler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial