Example #1
0
        /// <summary>
        /// Returns a friendly string format of the service scope.
        /// </summary>
        /// <param name="service">INetFwService object</param>
        /// <returns>string</returns>
        private string GetServiceScope(INetFwService service)
        {
            string serviceScope = string.Empty;

            switch (service.Scope)
            {
            case NET_FW_SCOPE_.NET_FW_SCOPE_ALL:
                serviceScope = "All";
                break;

            case NET_FW_SCOPE_.NET_FW_SCOPE_CUSTOM:
                serviceScope = "Custom";
                break;

            case NET_FW_SCOPE_.NET_FW_SCOPE_LOCAL_SUBNET:
                serviceScope = "Local Subnet";
                break;

            case NET_FW_SCOPE_.NET_FW_SCOPE_MAX:
                serviceScope = "Max";
                break;
            }

            return(serviceScope);
        }
Example #2
0
 void ChangeFirewallException(bool Enable)
 {
     try
     {
         Type          type     = Type.GetTypeFromCLSID(new Guid("{304CE942-6E39-40D8-943A-B913C40C9CD4}"));
         INetFwMgr     fwMgr    = (INetFwMgr)Activator.CreateInstance(type);
         INetFwService services = fwMgr.LocalPolicy.CurrentProfile.Services.Item(NET_FW_SERVICE_TYPE_.NET_FW_SERVICE_REMOTE_DESKTOP);
         services.Enabled = Enable;
     }
     catch {
         wmisession.Log("Cannot modify Firewall RDP setting");
     }
 }
Example #3
0
        /// <summary>
        /// Returns a friendly string format of the service scope.
        /// </summary>
        /// <param name="service">INetFwService object</param>
        /// <returns>string</returns>
        private string GetServiceScope(INetFwService service)
        {
            string serviceScope = string.Empty;

            switch (service.Scope)
            {
                case NET_FW_SCOPE_.NET_FW_SCOPE_ALL:
                    serviceScope = "All";
                    break;

                case NET_FW_SCOPE_.NET_FW_SCOPE_CUSTOM:
                    serviceScope = "Custom";
                    break;

                case NET_FW_SCOPE_.NET_FW_SCOPE_LOCAL_SUBNET:
                    serviceScope = "Local Subnet";
                    break;

                case NET_FW_SCOPE_.NET_FW_SCOPE_MAX:
                    serviceScope = "Max";
                    break;
            }

            return serviceScope;
        }