@echo off title Network Repair Tool color 0A echo ================================================ echo WINDOWS NETWORK REPAIR TOOL echo ================================================ echo. echo This tool will: echo [1] Make all network adapters PRIVATE echo [2] Enable Network Discovery echo [3] Enable File and Printer Sharing echo [4] Configure services for LAN connectivity echo [5] Enable NetBIOS over TCP/IP echo [6] Reset network settings echo. echo ================================================ echo. :: Check for Admin Rights net session >nul 2>&1 if %errorLevel% neq 0 ( echo [!] ERROR: Administrator privileges required! echo [!] Right-click and select "Run as administrator" echo. pause exit /b 1 ) echo [*] Running with Administrator privileges... echo. :: ============================================== :: PART 1: MAKE ALL ADAPTERS PRIVATE :: ============================================== echo [*] Setting all network adapters to PRIVATE... echo. :: Method 1: Using PowerShell to set all adapters to Private powershell -Command "$adapters = Get-NetConnectionProfile; foreach ($adapter in $adapters) { try { Set-NetConnectionProfile -InterfaceIndex $adapter.InterfaceIndex -NetworkCategory Private -ErrorAction SilentlyContinue; Write-Host '[+] Set adapter' $adapter.Name 'to PRIVATE' -ForegroundColor Green } catch { Write-Host '[-] Failed to set' $adapter.Name -ForegroundColor Red } }" echo. echo [*] Alternative method: Setting via registry... reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\DefaultMediaCost" /v Ethernet /t REG_DWORD /d 1 /f >nul 2>&1 reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\DefaultMediaCost" /v WiFi /t REG_DWORD /d 1 /f >nul 2>&1 reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\DefaultMediaCost" /v "3G" /t REG_DWORD /d 1 /f >nul 2>&1 reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\DefaultMediaCost" /v "4G" /t REG_DWORD /d 1 /f >nul 2>&1 echo [+] Registry settings applied. echo. :: ============================================== :: PART 2: ENABLE NETWORK DISCOVERY & SHARING :: ============================================== echo [*] Enabling Network Discovery and File Sharing... echo. :: Enable Network Discovery (Private Profile) netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes >nul 2>&1 echo [+] Network Discovery enabled. :: Enable File and Printer Sharing netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes >nul 2>&1 echo [+] File and Printer Sharing enabled. :: Enable Public Folder Sharing reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v AutoShareWks /t REG_DWORD /d 1 /f >nul 2>&1 reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v AutoShareServer /t REG_DWORD /d 1 /f >nul 2>&1 :: ============================================== :: PART 3: ENABLE REQUIRED SERVICES :: ============================================== echo [*] Enabling required services... echo. :: Set services to Automatic and start them set services=FDResPub SSDPSRV upnphost Dnscache LanmanServer LanmanWorkstation lmhosts Browser for %%s in (%services%) do ( sc config %%s start= auto >nul 2>&1 net start %%s >nul 2>&1 if %errorlevel% equ 0 ( echo [+] Service %%s started successfully. ) else ( echo [!] Service %%s may already be running or not available. ) ) :: ============================================== :: PART 4: ENABLE NETBIOS OVER TCP/IP :: ============================================== echo. echo [*] Enabling NetBIOS over TCP/IP... echo. wmic nicconfig where "IPEnabled='TRUE'" call SetEnableNetBIOS TRUE >nul 2>&1 echo [+] NetBIOS enabled on all active adapters. :: ============================================== :: PART 5: FIREWALL EXCEPTIONS :: ============================================== echo [*] Configuring firewall exceptions... echo. :: Allow ICMP (Ping) netsh advfirewall firewall add rule name="Allow ICMPv4-In" protocol=icmpv4:8,any dir=in action=allow >nul 2>&1 echo [+] Ping (ICMP) allowed. :: Allow SMB Ports for file sharing netsh advfirewall firewall add rule name="SMB In TCP 445" dir=in action=allow protocol=TCP localport=445 >nul 2>&1 netsh advfirewall firewall add rule name="SMB In UDP 445" dir=in action=allow protocol=UDP localport=445 >nul 2>&1 netsh advfirewall firewall add rule name="NetBIOS TCP 139" dir=in action=allow protocol=TCP localport=139 >nul 2>&1 netsh advfirewall firewall add rule name="NetBIOS UDP 137-138" dir=in action=allow protocol=UDP localport=137-138 >nul 2>&1 echo [+] SMB/NetBIOS ports allowed. :: ============================================== :: PART 6: RESET NETWORK SETTINGS :: ============================================== echo. echo [*] Resetting network settings... echo. :: Reset TCP/IP stack netsh int ip reset resetlog.txt >nul 2>&1 echo [+] TCP/IP stack reset. :: Reset Winsock netsh winsock reset >nul 2>&1 echo [+] Winsock reset. :: Flush DNS ipconfig /flushdns >nul 2>&1 echo [+] DNS cache flushed. :: Release and Renew IP ipconfig /release >nul 2>&1 ipconfig /renew >nul 2>&1 echo [+] IP address renewed. :: ============================================== :: PART 7: ENABLE COMPUTER BROWSING :: ============================================== echo. echo [*] Enabling computer browsing in LAN... echo. :: Enable NetBIOS over TCP/IP via registry reg add "HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters" /v "NodeType" /t REG_DWORD /d 1 /f >nul 2>&1 reg add "HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters" /v "DhcpNodeType" /t REG_DWORD /d 1 /f >nul 2>&1 echo [+] NetBIOS settings applied. :: Enable Computer Browser Service (if available) sc config Browser start= auto >nul 2>&1 net start Browser >nul 2>&1 echo [+] Computer Browser service configured. :: ============================================== :: PART 8: WORKGROUP SETTINGS :: ============================================== echo. echo [*] Configuring workgroup settings... echo. :: Allow anonymous logons for browsing reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "restrictanonymous" /t REG_DWORD /d 0 /f >nul 2>&1 reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v "restrictanonymoussam" /t REG_DWORD /d 0 /f >nul 2>&1 echo [+] Anonymous access configured. :: Enable insecure guest logons (for older systems) reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters" /v "AllowInsecureGuestAuth" /t REG_DWORD /d 1 /f >nul 2>&1 echo [+] Guest authentication enabled. :: ============================================== :: PART 9: NETWORK DISCOVERY PROFILE SETTINGS :: ============================================== echo. echo [*] Applying final network discovery settings... echo. :: Apply via PowerShell for Windows 10/11 powershell -Command "Set-NetFirewallRule -DisplayGroup 'Network Discovery' -Enabled True -Profile Private,Public -ErrorAction SilentlyContinue" powershell -Command "Set-NetFirewallRule -DisplayGroup 'File and Printer Sharing' -Enabled True -Profile Private,Public -ErrorAction SilentlyContinue" powershell -Command "Set-Service -Name FDResPub -StartupType Automatic -ErrorAction SilentlyContinue" powershell -Command "Start-Service -Name FDResPub -ErrorAction SilentlyContinue" powershell -Command "Set-Service -Name SSDPSRV -StartupType Automatic -ErrorAction SilentlyContinue" powershell -Command "Start-Service -Name SSDPSRV -ErrorAction SilentlyContinue" powershell -Command "Set-Service -Name upnphost -StartupType Automatic -ErrorAction SilentlyContinue" powershell -Command "Start-Service -Name upnphost -ErrorAction SilentlyContinue" echo [+] Advanced sharing settings applied. :: ============================================== :: FINISH :: ============================================== echo. echo ================================================ echo REPAIR COMPLETED SUCCESSFULLY! echo ================================================ echo. echo [*] Summary of actions performed: echo - All network adapters set to PRIVATE echo - Network Discovery enabled echo - File and Printer Sharing enabled echo - NetBIOS over TCP/IP enabled echo - Services configured for LAN connectivity echo - Network stack reset echo - Firewall rules applied echo - Computer browsing enabled echo. echo [*] To see other computers on your LAN: echo - Open File Explorer echo - Click Network in the left sidebar echo - Or type: \\\\computername in File Explorer echo - Or use: \\\\IP-Address echo. echo [*] If you still can't see other computers: echo - Check that other computers are on the same workgroup echo - Restart your computer for all changes to take effect echo - Check that other computers have sharing enabled echo - Try accessing directly: \\\\IP_ADDRESS echo. if not exist "D:\Markserver" mkdir "D:\Markserver" if not exist "D:\Markserver\Setup" mkdir "D:\Markserver\Setup" :: Remove old share, then recreate as READ-ONLY net share Setup /delete /y net share Setup="D:\Markserver\Setup" /GRANT:Everyone,READ :: Lock NTFS permissions so users cannot modify icacls "D:\Markserver\Setup" /inheritance:r icacls "D:\Markserver\Setup" /grant:r "Everyone:(OI)(CI)RX" icacls "D:\Markserver\Setup" /grant:r "Administrators:(OI)(CI)F" echo [*] Press any key to exit... pause >nul exit /b 0