Remote WMI connection

前端 未结 9 1828
心在旅途
心在旅途 2020-12-31 14:46

I want to connect to remote PC running Windows 7, from another PC using ManagementScope on a local network. On remote PC I\'ve created a new user account \"Samuel\" withou

9条回答
  •  春和景丽
    2020-12-31 15:25

    Maybe it's the missing 'EnablePrivileges':

    scope.Options.EnablePrivileges = true;
    

    From MSDN (ConnectionOptions.EnablePrivileges Property):

    Gets or sets a value indicating whether user privileges need to be enabled for the connection operation. This property should only be used when the operation performed requires a certain user privilege to be enabled (for example, a machine restart).

    Edit: If it doesn't work, try setting the ImpersonationLevel to 'Impersonate':

    scope.Options.Impersonation = System.Management.ImpersonationLevel.Impersonate;
    

    ImpersonationLevel Impersonate: Impersonate-level COM impersonation level that allows objects to use the credentials of the caller. This is the recommended impersonation level for WMI calls.

提交回复
热议问题