Advertisement
Guest User

File Name

a guest
Oct 27th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Admin-Loader
  2. If  (-NOT([Security.Principal.WindowsPrincipal]`
  3.           [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
  4.           [Security.Principal.WindowsBuiltInRole] “Administrator”))
  5.     {
  6.         $Args = ("'" + $PSCommandPath + "'")
  7.         Start-Process Powershell -Verb runAs -ArgumentList "& $Args"
  8.         Break
  9.     }
  10.  
  11. #Script-Start
  12.     #Configuring Firewall
  13.         #Defining Subnets
  14.         $LocalSubnet = "192.168.0.0/255.255.255.0"
  15.    
  16.         #Enabling Windows Firewall
  17.         Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True
  18.  
  19.         #Setting Inbound/outbound policy
  20.         Set-NetFirewallProfile -All `
  21.         -AllowInboundRules True `
  22.         -DefaultInboundAction Block `
  23.         -DefaultOutboundAction Allow `
  24.         -LogAllowed False `
  25.         -LogIgnored False `
  26.         -LogBlocked False `
  27.         -NotifyOnListen False
  28.  
  29.         #Clearing Firewall Rules
  30.         Remove-NetFirewallRule -All
  31.  
  32.         #Defining Rules
  33.             #File and Printer Sharing
  34.             New-NetFirewallRule -Name 'FPS-LLMNR-In-UDP' `
  35.             -DisplayName              'File and Printer Sharing (LLMNR-UDP-In)' `
  36.             -Description              'Inbound rule for File and Printer Sharing to allow Link Local Multicast Name Resolution. [UDP 5355]' `
  37.             -Group                    '@FirewallAPI.dll,-28502' `
  38.             -Enabled                  'True' `
  39.             -Profile                  'Private' `
  40.             -Direction                'Inbound' `
  41.             -Action                   'Allow' `
  42.             -LocalAddress             $LocalSubnet `
  43.             -RemoteAddress            $LocalSubnet `
  44.             -Service                  'dnscache' `
  45.             -Program                  '%SystemRoot%\system32\svchost.exe' `
  46.             -Protocol                 'UDP' `
  47.             -LocalPort                '5355' `
  48.             -RemotePort               'Any' `
  49.             -IcmpType                 'Any' `
  50.             -DynamicTarget            'Any'
  51.  
  52.             New-NetFirewallRule -Name 'FPS-ICMP4-ERQ-In' `
  53.             -DisplayName              'File and Printer Sharing (Echo Request - ICMPv4-In)' `
  54.             -Description              'Echo Request messages are sent as ping requests to other nodes.' `
  55.             -Group                    '@FirewallAPI.dll,-28502' `
  56.             -Enabled                  'True' `
  57.             -Profile                  'Private' `
  58.             -Direction                'Inbound' `
  59.             -Action                   'Allow' `
  60.             -LocalAddress             $LocalSubnet `
  61.             -RemoteAddress            $LocalSubnet `
  62.             -Service                  'Any' `
  63.             -Program                  'Any' `
  64.             -Protocol                 'ICMPv4' `
  65.             -LocalPort                'RPC' `
  66.             -RemotePort               'Any' `
  67.             -IcmpType                 '8' `
  68.             -DynamicTarget            'Any'
  69.  
  70.             New-NetFirewallRule -Name 'FPS-ICMP6-ERQ-In' `
  71.             -DisplayName              'File and Printer Sharing (Echo Request - ICMPv6-In)' `
  72.             -Description              'Echo Request messages are sent as ping requests to other nodes.' `
  73.             -Group                    '@FirewallAPI.dll,-28502' `
  74.             -Enabled                  'True' `
  75.             -Profile                  'Private' `
  76.             -Direction                'Inbound' `
  77.             -Action                   'Allow' `
  78.             -LocalAddress             $LocalSubnet `
  79.             -RemoteAddress            $LocalSubnet `
  80.             -Service                  'Any' `
  81.             -Program                  'Any' `
  82.             -Protocol                 'ICMPv6' `
  83.             -LocalPort                'RPC' `
  84.             -RemotePort               'Any' `
  85.             -IcmpType                 '128' `
  86.             -DynamicTarget            'Any'
  87.        
  88.             New-NetFirewallRule -Name 'FPS-NB_Datagram-In-UDP' `
  89.             -DisplayName              'File and Printer Sharing (NB-Datagram-In)' `
  90.             -Description              'Inbound rule for File and Printer Sharing to allow NetBIOS Datagram transmission and reception. [UDP 138]' `
  91.             -Group                    '@FirewallAPI.dll,-28502' `
  92.             -Enabled                  'True' `
  93.             -Profile                  'Private' `
  94.             -Direction                'Inbound' `
  95.             -Action                   'Allow' `
  96.             -LocalAddress             $LocalSubnet `
  97.             -RemoteAddress            $LocalSubnet `
  98.             -Service                  'Any' `
  99.             -Program                  'System' `
  100.             -Protocol                 'UDP' `
  101.             -LocalPort                '138' `
  102.             -RemotePort               'Any' `
  103.             -IcmpType                 'Any' `
  104.             -DynamicTarget            'Any'
  105.        
  106.             New-NetFirewallRule -Name 'FPS-NB_Name-In-UDP' `
  107.             -DisplayName              'File and Printer Sharing (NB-Name-In)' `
  108.             -Description              'Inbound rule for File and Printer Sharing to allow NetBIOS Name Resolution. [UDP 137]' `
  109.             -Group                    '@FirewallAPI.dll,-28502' `
  110.             -Enabled                  'True' `
  111.             -Profile                  'Private' `
  112.             -Direction                'Inbound' `
  113.             -Action                   'Allow' `
  114.             -LocalAddress             $LocalSubnet `
  115.             -RemoteAddress            $LocalSubnet `
  116.             -Service                  'Any' `
  117.             -Program                  'System' `
  118.             -Protocol                 'UDP' `
  119.             -LocalPort                '137' `
  120.             -RemotePort               'Any' `
  121.             -IcmpType                 'Any' `
  122.             -DynamicTarget            'Any'
  123.        
  124.             New-NetFirewallRule -Name 'FPS-NB_Session-In-TCP' `
  125.             -DisplayName              'File and Printer Sharing (NB-Session-In)' `
  126.             -Description              'Inbound rule for File and Printer Sharing to allow NetBIOS Session Service connections. [TCP 139]' `
  127.             -Group                    '@FirewallAPI.dll,-28502' `
  128.             -Enabled                  'True' `
  129.             -Profile                  'Private' `
  130.             -Direction                'Inbound' `
  131.             -Action                   'Allow' `
  132.             -LocalAddress             $LocalSubnet `
  133.             -RemoteAddress            $LocalSubnet `
  134.             -Service                  'Any' `
  135.             -Program                  'System' `
  136.             -Protocol                 'TCP' `
  137.             -LocalPort                '139' `
  138.             -RemotePort               'Any' `
  139.             -IcmpType                 'Any' `
  140.             -DynamicTarget            'Any'
  141.        
  142.             New-NetFirewallRule -Name 'FPS-SMB-In-TCP' `
  143.             -DisplayName              'File and Printer Sharing (SMB-In)' `
  144.             -Description              'Inbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. [TCP 445]' `
  145.             -Group                    '@FirewallAPI.dll,-28502' `
  146.             -Enabled                  'True' `
  147.             -Profile                  'Private' `
  148.             -Direction                'Inbound' `
  149.             -Action                   'Allow' `
  150.             -LocalAddress             $LocalSubnet `
  151.             -RemoteAddress            $LocalSubnet `
  152.             -Service                  'Any' `
  153.             -Program                  'System' `
  154.             -Protocol                 'TCP' `
  155.             -LocalPort                '445' `
  156.             -RemotePort               'Any' `
  157.             -IcmpType                 'Any' `
  158.             -DynamicTarget            'Any'
  159.        
  160.             New-NetFirewallRule -Name 'FPS-SpoolSvc-In-TCP' `
  161.             -DisplayName              'File and Printer Sharing (Spooler Service - RPC)' `
  162.             -Description              'Inbound rule for File and Printer Sharing to allow the Print Spooler Service to communicate via TCP/RPC.' `
  163.             -Group                    '@FirewallAPI.dll,-28502' `
  164.             -Enabled                  'True' `
  165.             -Profile                  'Private' `
  166.             -Direction                'Inbound' `
  167.             -Action                   'Allow' `
  168.             -LocalAddress             $LocalSubnet `
  169.             -RemoteAddress            $LocalSubnet `
  170.             -Service                  'Spooler' `
  171.             -Program                  '%SystemRoot%\system32\spoolsv.exe' `
  172.             -Protocol                 'TCP' `
  173.             -LocalPort                'RPC' `
  174.             -RemotePort               'Any' `
  175.             -IcmpType                 'Any' `
  176.             -DynamicTarget            'Any'
  177.        
  178.             New-NetFirewallRule -Name 'FPS-RPCSS-In-TCP' `
  179.             -DisplayName              'File and Printer Sharing (Spooler Service - RPC-EPMAP)' `
  180.             -Description              'Inbound rule for the RPCSS service to allow RPC/TCP traffic for the Spooler Service.' `
  181.             -Group                    '@FirewallAPI.dll,-28502' `
  182.             -Enabled                  'True' `
  183.             -Profile                  'Private' `
  184.             -Direction                'Inbound' `
  185.             -Action                   'Allow' `
  186.             -LocalAddress             $LocalSubnet `
  187.             -RemoteAddress            $LocalSubnet `
  188.             -Service                  'Rpcss' `
  189.             -Program                  'Any' `
  190.             -Protocol                 'TCP' `
  191.             -LocalPort                'RPCEPMap' `
  192.             -RemotePort               'Any' `
  193.             -IcmpType                 'Any' `
  194.             -DynamicTarget            'Any'
  195.        
  196.             New-NetFirewallRule -Name 'FPSSMBD-iWARP-In-TCP' `
  197.             -DisplayName              'File and Printer Sharing over SMBDirect (iWARP-In)' `
  198.             -Description              'Inbound rule for File and Printer Sharing over SMBDirect to allow iWARP [TCP 5445]' `
  199.             -Group                    '@FirewallAPI.dll,-28502' `
  200.             -Enabled                  'True' `
  201.             -Profile                  'Private' `
  202.             -Direction                'Inbound' `
  203.             -Action                   'Allow' `
  204.             -LocalAddress             $LocalSubnet `
  205.             -RemoteAddress            $LocalSubnet `
  206.             -Service                  'Any' `
  207.             -Program                  'System' `
  208.             -Protocol                 'TCP' `
  209.             -LocalPort                '5445' `
  210.             -RemotePort               'Any' `
  211.             -IcmpType                 'Any' `
  212.             -DynamicTarget            'Any'
  213.        
  214.             #Netowork Discovery
  215.             New-NetFirewallRule -Name 'NETDIS-LLMNR-In-UDP-Active' `
  216.             -DisplayName              'Network Discovery (LLMNR-UDP-In)' `
  217.             -Description              'Inbound rule for Network Discovery to allow Link Local Multicast Name Resolution. [UDP 5355]' `
  218.             -Group                    '@FirewallAPI.dll,-32752' `
  219.             -Enabled                  'True' `
  220.             -Profile                  'Private' `
  221.             -Direction                'Inbound' `
  222.             -Action                   'Allow' `
  223.             -LocalAddress             $LocalSubnet `
  224.             -RemoteAddress            $LocalSubnet `
  225.             -Service                  'dnscache' `
  226.             -Program                  '%SystemRoot%\system32\svchost.exe' `
  227.             -Protocol                 'UDP' `
  228.             -LocalPort                '5355' `
  229.             -RemotePort               'Any' `
  230.             -IcmpType                 'Any' `
  231.             -DynamicTarget            'Any'
  232.        
  233.             New-NetFirewallRule -Name 'NETDIS-NB_Datagram-In-UDP-Active' `
  234.             -DisplayName              'Network Discovery (NB-Datagram-In)' `
  235.             -Description              'Inbound rule for Network Discovery to allow NetBIOS Datagram transmission and reception. [UDP 138]' `
  236.             -Group                    '@FirewallAPI.dll,-32752' `
  237.             -Enabled                  'True' `
  238.             -Profile                  'Private' `
  239.             -Direction                'Inbound' `
  240.             -Action                   'Allow' `
  241.             -LocalAddress             $LocalSubnet `
  242.             -RemoteAddress            $LocalSubnet `
  243.             -Service                  'Any' `
  244.             -Program                  'System' `
  245.             -Protocol                 'UDP' `
  246.             -LocalPort                '138' `
  247.             -RemotePort               'Any' `
  248.             -IcmpType                 'Any' `
  249.             -DynamicTarget            'Any'
  250.        
  251.             New-NetFirewallRule -Name 'NETDIS-NB_Name-In-UDP-Active' `
  252.             -DisplayName              'Network Discovery (NB-Name-In)' `
  253.             -Description              'Inbound rule for Network Discovery to allow NetBIOS Name Resolution. [UDP 137]' `
  254.             -Group                    '@FirewallAPI.dll,-32752' `
  255.             -Enabled                  'True' `
  256.             -Profile                  'Private' `
  257.             -Direction                'Inbound' `
  258.             -Action                   'Allow' `
  259.             -LocalAddress             $LocalSubnet `
  260.             -RemoteAddress            $LocalSubnet `
  261.             -Service                  'Any' `
  262.             -Program                  'System' `
  263.             -Protocol                 'UDP' `
  264.             -LocalPort                '137' `
  265.             -RemotePort               'Any' `
  266.             -IcmpType                 'Any' `
  267.             -DynamicTarget            'Any'
  268.        
  269.        
  270.             New-NetFirewallRule -Name 'NETDIS-FDRESPUB-WSD-In-UDP-Active' `
  271.             -DisplayName              'Network Discovery (Pub-WSD-In)' `
  272.             -Description              'Inbound rule for Network Discovery to discover devices via Function Discovery. [UDP 3702]' `
  273.             -Group                    '@FirewallAPI.dll,-32752' `
  274.             -Enabled                  'True' `
  275.             -Profile                  'Private' `
  276.             -Direction                'Inbound' `
  277.             -Action                   'Allow' `
  278.             -LocalAddress             $LocalSubnet `
  279.             -RemoteAddress            $LocalSubnet `
  280.             -Service                  'fdrespub' `
  281.             -Program                  '%SystemRoot%\system32\svchost.exe' `
  282.             -Protocol                 'UDP' `
  283.             -LocalPort                '3702' `
  284.             -RemotePort               'Any' `
  285.             -IcmpType                 'Any' `
  286.             -DynamicTarget            'Any'
  287.        
  288.             New-NetFirewallRule -Name 'NETDIS-SSDPSrv-In-UDP-Activee' `
  289.             -DisplayName              'Network Discovery (SSDP-In)' `
  290.             -Description              'Inbound rule for Network Discovery to allow use of the Simple Service Discovery Protocol. [UDP 1900]' `
  291.             -Group                    '@FirewallAPI.dll,-32752' `
  292.             -Enabled                  'True' `
  293.             -Profile                  'Private' `
  294.             -Direction                'Inbound' `
  295.             -Action                   'Allow' `
  296.             -LocalAddress             $LocalSubnet `
  297.             -RemoteAddress            $LocalSubnet `
  298.             -Service                  'Ssdpsrv' `
  299.             -Program                  '%SystemRoot%\system32\svchost.exe' `
  300.             -Protocol                 'UDP' `
  301.             -LocalPort                '1900' `
  302.             -RemotePort               'Any' `
  303.             -IcmpType                 'Any' `
  304.             -DynamicTarget            'Any'
  305.        
  306.             New-NetFirewallRule -Name 'NETDIS-UPnPHost-In-TCP-Active' `
  307.             -DisplayName              'Network Discovery (UPnP-In)' `
  308.             -Description              'Inbound rule for Network Discovery to allow use of Universal Plug and Play. [TCP 2869]' `
  309.             -Group                    '@FirewallAPI.dll,-32752' `
  310.             -Enabled                  'True' `
  311.             -Profile                  'Private' `
  312.             -Direction                'Inbound' `
  313.             -Action                   'Allow' `
  314.             -LocalAddress             $LocalSubnet `
  315.             -RemoteAddress            $LocalSubnet `
  316.             -Service                  'Any' `
  317.             -Program                  'System' `
  318.             -Protocol                 'TCP' `
  319.             -LocalPort                '2869' `
  320.             -RemotePort               'Any' `
  321.             -IcmpType                 'Any' `
  322.             -DynamicTarget            'Any'
  323.        
  324.             New-NetFirewallRule -Name 'NETDIS-WSDEVNT-In-TCP-Active' `
  325.             -DisplayName              'Network Discovery (WSD Events-In)' `
  326.             -Description              'Inbound rule for Network Discovery to allow WSDAPI Events via Function Discovery. [TCP 5357]' `
  327.             -Group                    '@FirewallAPI.dll,-32752' `
  328.             -Enabled                  'True' `
  329.             -Profile                  'Private' `
  330.             -Direction                'Inbound' `
  331.             -Action                   'Allow' `
  332.             -LocalAddress             $LocalSubnet `
  333.             -RemoteAddress            $LocalSubnet `
  334.             -Service                  'Any' `
  335.             -Program                  'System' `
  336.             -Protocol                 'TCP' `
  337.             -LocalPort                '5357' `
  338.             -RemotePort               'Any' `
  339.             -IcmpType                 'Any' `
  340.             -DynamicTarget            'Any'
  341.        
  342.             New-NetFirewallRule -Name 'NETDIS-WSDEVNTS-In-TCP-Active' `
  343.             -DisplayName              'Network Discovery (WSD EventsSecure-In)' `
  344.             -Description              'Inbound rule for Network Discovery to allow Secure WSDAPI Events via Function Discovery. [TCP 5358]' `
  345.             -Group                    '@FirewallAPI.dll,-32752' `
  346.             -Enabled                  'True' `
  347.             -Profile                  'Private' `
  348.             -Direction                'Inbound' `
  349.             -Action                   'Allow' `
  350.             -LocalAddress             $LocalSubnet `
  351.             -RemoteAddress            $LocalSubnet `
  352.             -Service                  'Any' `
  353.             -Program                  'System' `
  354.             -Protocol                 'TCP' `
  355.             -LocalPort                '5358' `
  356.             -RemotePort               'Any' `
  357.             -IcmpType                 'Any' `
  358.             -DynamicTarget            'Any'
  359.        
  360.             New-NetFirewallRule -Name 'NETDIS-FDPHOST-In-UDP-Active' `
  361.             -DisplayName              'Network Discovery (WSD-In)' `
  362.             -Description              'Inbound rule for Network Discovery to discover devices via Function Discovery. [UDP 3702]' `
  363.             -Group                    '@FirewallAPI.dll,-32752' `
  364.             -Enabled                  'True' `
  365.             -Profile                  'Private' `
  366.             -Direction                'Inbound' `
  367.             -Action                   'Allow' `
  368.             -LocalAddress             $LocalSubnet `
  369.             -RemoteAddress            $LocalSubnet `
  370.             -Service                  'fdphost' `
  371.             -Program                  '%SystemRoot%\system32\svchost.exe' `
  372.             -Protocol                 'UDP' `
  373.             -LocalPort                '3702' `
  374.             -RemotePort               'Any' `
  375.             -IcmpType                 'Any' `
  376.             -DynamicTarget            'Any'
  377.        
  378.             New-NetFirewallRule -Name 'NETDIS-DAS-In-UDP-Activee' `
  379.             -DisplayName              'Network Discovery (WSD-In)' `
  380.             -Description              'Inbound rule for Network Discovery to discover devices via Device Association Framework. [UDP 3702]' `
  381.             -Group                    '@FirewallAPI.dll,-32752' `
  382.             -Enabled                  'True' `
  383.             -Profile                  'Private' `
  384.             -Direction                'Inbound' `
  385.             -Action                   'Allow' `
  386.             -LocalAddress             $LocalSubnet `
  387.             -RemoteAddress            $LocalSubnet `
  388.             -Service                  'Any' `
  389.             -Program                  '%SystemRoot%\system32\dashost.exe' `
  390.             -Protocol                 'UDP' `
  391.             -LocalPort                '3702' `
  392.             -RemotePort               'Any' `
  393.             -IcmpType                 'Any' `
  394.             -DynamicTarget            'Any'
  395.  
  396.             #Remote Desktop
  397.             New-NetFirewallRule -Name 'RemoteDesktop-UserMode-In-TCP' `
  398.             -DisplayName              'Remote Desktop - User Mode (TCP-In)' `
  399.             -Description              'Inbound rule for the Remote Desktop service to allow RDP traffic. [TCP 3389]' `
  400.             -Group                    '@FirewallAPI.dll,-28752' `
  401.             -Enabled                  'True' `
  402.             -Profile                  'Private' `
  403.             -Direction                'Inbound' `
  404.             -Action                   'Allow' `
  405.             -LocalAddress             $LocalSubnet `
  406.             -RemoteAddress            $LocalSubnet `
  407.             -Service                  'termservice' `
  408.             -Program                  '%SystemRoot%\system32\svchost.exe' `
  409.             -Protocol                 'TCP' `
  410.             -LocalPort                '3389' `
  411.             -RemotePort               'Any' `
  412.             -IcmpType                 'Any' `
  413.             -DynamicTarget            'Any'
  414.            
  415.             New-NetFirewallRule -Name 'RemoteDesktop-UserMode-In-UDP' `
  416.             -DisplayName              'Remote Desktop - User Mode (UDP-In)' `
  417.             -Description              'Inbound rule for the Remote Desktop service to allow RDP traffic. [UDP 3389]' `
  418.             -Group                    '@FirewallAPI.dll,-28752' `
  419.             -Enabled                  'True' `
  420.             -Profile                  'Private' `
  421.             -Direction                'Inbound' `
  422.             -Action                   'Allow' `
  423.             -LocalAddress             $LocalSubnet `
  424.             -RemoteAddress            $LocalSubnet `
  425.             -Service                  'termservice' `
  426.             -Program                  '%SystemRoot%\system32\svchost.exe' `
  427.             -Protocol                 'UDP' `
  428.             -LocalPort                '3389' `
  429.             -RemotePort               'Any' `
  430.             -IcmpType                 'Any' `
  431.             -DynamicTarget            'Any'
  432.        
  433.         #Nulling Variables
  434.         $LocalSubnet = $null
  435.        
  436.     #Poweroptions
  437.     powercfg -h off
  438.    
  439.     #Setting registry keys
  440.         #Initialize an array
  441.         $RegistryEntries = @()
  442.  
  443.             #Create a PSObject with the associated properties hashtable
  444.                 #Disabling Xbox Capture
  445.                 $RegTable = new-object PSObject -Property @{ Key          = 'Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR';
  446.                                                              Name         = 'AppCaptureEnabled';
  447.                                                              PropertyType = 'Dword';
  448.                                                              Value        = '0'}
  449.                 $RegistryEntries += $regtable
  450.                
  451.                 #Disabling Xbox Capture
  452.                 $RegTable = new-object PSObject -Property @{ Key          = 'Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR';
  453.                                                              Name         = 'AudioCaptureEnabled';
  454.                                                              PropertyType = 'Dword';
  455.                                                              Value        = '0'}
  456.                 $RegistryEntries += $regtable
  457.                
  458.                 #Disabling Xbox Capture
  459.                 $RegTable = new-object PSObject -Property @{ Key          = 'Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR';
  460.                                                              Name         = 'HistoricalCaptureEnabled';
  461.                                                              PropertyType = 'Dword';
  462.                                                              Value        = '0'}
  463.                 $RegistryEntries += $regtable
  464.                
  465.                 #Disabling Xbox Game Mode
  466.                 $RegTable = new-object PSObject -Property @{ Key          = 'Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\GameBar';
  467.                                                              Name         = 'AllowAutoGameMode';
  468.                                                              PropertyType = 'Dword';
  469.                                                              Value        = '0'}
  470.                 $RegistryEntries += $regtable
  471.  
  472.                 #Disabling Xbox GameDVR overlay
  473.                 $RegTable = new-object PSObject -Property @{ Key          = 'Registry::HKEY_CURRENT_USER\SYSTEM\GameConfigStore';
  474.                                                              Name         = 'GameDVR_Enabled';
  475.                                                              PropertyType = 'Dword';
  476.                                                              Value        = '0'}
  477.                 $RegistryEntries += $regtable
  478.  
  479.                 #Disabling Cortana
  480.                 $RegTable = new-object PSObject -Property @{ Key          = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search';
  481.                                                              Name         = 'AllowCortana';
  482.                                                              PropertyType = 'Dword';
  483.                                                              Value        = '0'}
  484.                 $RegistryEntries += $regtable
  485.  
  486.                 #Disabling Cortana Lock Screen
  487.                 $RegTable = new-object PSObject -Property @{ Key          = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search';
  488.                                                              Name         = 'AllowCortanaAboveLock';
  489.                                                              PropertyType = 'Dword';
  490.                                                              Value        = '0'}
  491.                 $RegistryEntries += $regtable
  492.  
  493.                 #Disabling Start Menu suggested content
  494.                 $RegTable = new-object PSObject -Property @{ Key          = 'REGISTRY::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CloudContent';
  495.                                                              Name         = 'DisableWindowsConsumerFeatures';
  496.                                                              PropertyType = 'Dword';
  497.                                                              Value        = '1'}
  498.                 $RegistryEntries += $regtable
  499.                
  500.                 #Setting Explorer LaunchTo
  501.                 $RegTable = new-object PSObject -Property @{ Key          = 'REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced';
  502.                                                              Name         = 'LaunchTo';
  503.                                                              PropertyType = 'Dword';
  504.                                                              Value        = '1'}
  505.                 $RegistryEntries += $regtable
  506.                
  507.                 #Setting Explorer ShowRecent
  508.                 $RegTable = new-object PSObject -Property @{ Key          = 'REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer';
  509.                                                              Name         = 'ShowRecent';
  510.                                                              PropertyType = 'Dword';
  511.                                                              Value        = '0'}
  512.                 $RegistryEntries += $regtable
  513.  
  514.                 #Setting Explorer ShowFrequent
  515.                 $RegTable = new-object PSObject -Property @{ Key          = 'REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer';
  516.                                                              Name         = 'ShowFrequent';
  517.                                                              PropertyType = 'Dword';
  518.                                                              Value        = '0'}
  519.                 $RegistryEntries += $regtable
  520.                
  521.                 #Setting Explorer HideFileExt
  522.                 $RegTable = new-object PSObject -Property @{ Key          = 'REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced';
  523.                                                              Name         = 'HideFileExt';
  524.                                                              PropertyType = 'Dword';
  525.                                                              Value        = '0'}
  526.                 $RegistryEntries += $regtable
  527.                
  528.                 #Setting Explorer Hidden
  529.                 $RegTable = new-object PSObject -Property @{ Key          = 'REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced';
  530.                                                              Name         = 'Hidden';
  531.                                                              PropertyType = 'Dword';
  532.                                                              Value        = '1'}
  533.                 $RegistryEntries += $regtable
  534.                
  535.                 #Setting Explorer HideDrivesWithNoMedia
  536.                 $RegTable = new-object PSObject -Property @{ Key          = 'REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced';
  537.                                                              Name         = 'HideDrivesWithNoMedia';
  538.                                                              PropertyType = 'Dword';
  539.                                                              Value        = '0'}
  540.                 $RegistryEntries += $regtable
  541.                
  542.                 #Setting Explorer Autoplay
  543.                 $RegTable = new-object PSObject -Property @{ Key          = 'REGISTRY::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers';
  544.                                                              Name         = 'DisableAutoplay';
  545.                                                              PropertyType = 'Dword';
  546.                                                              Value        = '1'}
  547.                 $RegistryEntries += $regtable
  548.  
  549.         #Invoking registry changes
  550.         ForEach ($line in $RegistryEntries)
  551.         {
  552.             IF ((Test-Path -Path $line.key)-ne "True")
  553.             {
  554.                 New-Item -Path $line.key | out-Null
  555.             }
  556.             New-ItemProperty -Force -Path $line.key -Name $line.name -Value $line.value -PropertyType $line.propertytype
  557.         }
  558.  
  559.         #Nulling Variables
  560.         $line = $null
  561.         $RegistryEntries = $null
  562.         $RegTable = $null
  563.  
  564.  
  565.     #Configuring Services
  566.     $StopServiceArray = @('HomeGroupListener';
  567.                           'HomeGroupProvider')
  568.                      
  569.     ForEach ($line in $StopServiceArray)
  570.         {
  571.             Stop-Service -Name $line
  572.             Set-Service -Name $line -Status Stopped -StartupType Disabled
  573.         }
  574.  
  575.         #Nulling Variables
  576.         $line = $null
  577.         $StopServiceArray = $null
  578.  
  579.     #uninstalling store apps
  580.     $WindowsApps = @('Microsoft.3DBuilder',
  581.                      'Microsoft.BingWeather',
  582.                      'Microsoft.DesktopAppInstaller',
  583.                      'Microsoft.GetHelp',
  584.                      'Microsoft.Getstarted',
  585.                      'Microsoft.Messaging',
  586.                      'Microsoft.Microsoft3DViewer',
  587.                      'Microsoft.MicrosoftOfficeHub',
  588.                      'Microsoft.MicrosoftSolitaireCollection',
  589.                      'Microsoft.Office.OneNote',
  590.                      'Microsoft.OneConnect',
  591.                      'Microsoft.People',
  592.                      'Microsoft.Print3D',
  593.                      'Microsoft.SkypeApp',
  594.                      'Microsoft.WindowsAlarms',
  595.                      'Microsoft.WindowsCamera',
  596.                      'microsoft.windowscommunicationsapps',
  597.                      'Microsoft.WindowsFeedbackHub',
  598.                      'Microsoft.WindowsMaps',
  599.                      'Microsoft.WindowsSoundRecorder',
  600.                      'Microsoft.Xbox.TCUI',
  601.                      'Microsoft.XboxApp',
  602.                      'Microsoft.XboxGameOverlay',
  603.                      'Microsoft.XboxIdentityProvider',
  604.                      'Microsoft.XboxSpeechToTextOverlay',
  605.                      'Microsoft.ZuneMusic',
  606.                      'Microsoft.ZuneVideo',
  607.                      'king.com.CandyCrushSodaSaga',
  608.                      'Facebook.Facebook',
  609.                      'Microsoft.BingNews',
  610.                      'Microsoft.MinecraftUWP',
  611.                      'A278AB0D.MarchofEmpires',
  612.                      '9E2F88E3.Twitter')
  613.  
  614.     foreach ($App in $WindowsApps)
  615.         {
  616.             Get-AppxPackage -Name $App | Remove-AppxPackage -ErrorAction SilentlyContinue | Out-Null
  617.             Get-AppXProvisionedPackage -Online | Where-Object DisplayName -eq $App | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue | Out-Null
  618.         }
  619.    
  620.         #Nulling Variables
  621.         $WindowsApps = $null
  622.         $App = $null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement