System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
I then went duh, the service account that it is running under wouldn’t have access to the network.
I suppose you could change the account on the service itself, but for a quick fix I changed
With WMIConnectionOptions
.Impersonation = System.Management.ImpersonationLevel.Impersonate
.Authentication = System.Management.AuthenticationLevel.Packet
End With
To:
With WMIConnectionOptions
.username = “my username”
.Password = “my password”
.Impersonation = System.Management.ImpersonationLevel.Impersonate
.Authentication = System.Management.AuthenticationLevel.Packet
End With
And that did the trick