How to use FSharp.Management WMI Provider with remote machine

Viewed 210

I've modified the example script from the FSharp management project to connect to a remote host rather than localhost:

System.IO.Directory.SetCurrentDirectory (__SOURCE_DIRECTORY__)

#r @"System.Management.dll"
#r @"..\Packages\FSharp.Management.0.3.1\lib\net40\FSharp.Management.dll"
#r @"..\Packages\FSharp.Management.0.3.1\lib\net40\FSharp.Management.WMI.dll"

open FSharp.Management

type Remote = WmiProvider<"remotehost@username:password">
let data = Remote.GetDataContext()

Unfortunately I get an error the GetDataContext is not defined on Remote. But if I change the WmiProvider to be WmiProvider<"localhost"> the it works as expected.

I wasn't sure if the login is correct but if I change the username or password to something I know to be incorrect the the WmiProvider line returns an RPC error so I am sure it is logging in correctly.

1 Answers
Related