咨询热线:020-82315523 18988993510 18988993505

服务器开启共享功能,电脑开启共享功能,一建bat命令行开启系统共享功能

一键开启共享功能等bat.rar
f286fb7e77e218a2d761b48635eb44a4.rar (4.04 KB)
开启共享要确保“Server”“TCP/IP NetBIOS Helper”“Workstation”服务是启动状态
一键开启共享功能,将下面的保存为bat执行即可:
@echo off
:wwwpiiscn
cls
mode 76, 32
title  开启或关闭共享、Windows更新等功能
echo:
echo:
echo:
echo        【注意:开启共享会存在安全问题,用不上共享或不是域环境请关闭共享】         
echo         ____________________________________________________________
echo:
echo                 [1] 开启系统共享功能【可能需重启后生效】
echo:
echo                 [2] 关闭系统共享功能【可能需重启后生效】
echo                 ____________________________________________
echo:
echo                 [3] 开启或关闭系统更新功能
echo                 ____________________________________________
echo:
echo                 [4] 开启或关闭系统显示缩略图【重启后生效】
echo                 ____________________________________________
echo:
echo                 [5] 开启打印机服务     [6] 关闭打印机服务
echo:
echo                 [7] 打开打印机共享端口[打印机不共享请勿打开]
echo                 ____________________________________________
echo:
echo                 [8] 安装Active Directory域控制器
echo:
echo                 [9] 作为客户机加入域开放端口[无需装域控]
echo                 ____________________________________________
echo:
echo                 [0] 退出
echo         ____________________________________________________________
echo:
echo         请在键盘中输入菜单选项[1,2,3,4,5,6,7,8,9,0]
choice /C:1234567890 /N
if errorlevel==10  exit /b
if errorlevel==9  goto :ActiveDirectoryPort
if errorlevel==8  goto :openActiveDirectory
if errorlevel==7  goto :openPrintPort
if errorlevel==6  goto :closePrint
if errorlevel==5  goto :openPrint
if errorlevel==4  goto :thumbnail
if errorlevel==3  goto :windowsupdate
if errorlevel==2  goto :closeSharing
if errorlevel==1  goto :openSharing

:openSharing
cls
mode 110, 34
title 开启共享功能[可能需要重启服务器]
echo:
echo         开启共享会使得系统不安全,用不上共享或非域环境请关闭共享
echo         ____________________________________________________________
echo:
echo                 [1] 开启系统共享功能【可能需重启后生效】
echo:
echo                 [2] 关闭系统共享功能【域环境中不要关闭】
echo                 ____________________________________________
echo:
echo                 [0] 返回
echo         ____________________________________________________________
echo:
echo         请在键盘中输入菜单选项[1,2,0]
choice /C:120 /N
if errorlevel==3  goto :wwwpiiscn
if errorlevel==2  goto :closeSharing
if errorlevel==1  goto :openSharing2
:openSharing2
cls
mode 110, 34
title  开启共享功能[可能需要重启服务器]
echo 开启Server,TCP/IP NetBIOS Helper,Workstation三个服务
sc config LanmanServer start= auto
net start LanmanServer
sc config lmhosts start= auto
net start lmhosts
sc config LanmanWorkstation start= auto
net start LanmanWorkstation
netsh advfirewall set allprofiles state on
rem 开启Windows系统自带的防火墙,on为开启,而off为关闭
netsh advfirewall firewall delete rule name="开放共享和域的TCP端口"
netsh advfirewall firewall delete rule name="开放共享和域的TCP端口"
netsh advfirewall firewall delete rule name="开放打印机TCP端口"
netsh advfirewall firewall delete rule name="开放打印机UDP端口"
netsh advfirewall firewall delete rule name="关闭高危险TCP端口"
netsh advfirewall firewall delete rule name="关闭高危险UDP端口"
netsh advfirewall firewall delete rule name="关闭危险TCP端口"
netsh advfirewall firewall delete rule name="关闭危险UDP端口"
netsh advfirewall firewall delete rule name="关闭TCP1025端口"
netsh advfirewall firewall delete rule name="关闭TCP1211端口"
netsh advfirewall firewall delete rule name="关闭TCP135端口"
netsh advfirewall firewall delete rule name="关闭TCP137-139端口"
netsh advfirewall firewall delete rule name="关闭TCP1720端口"
netsh advfirewall firewall delete rule name="关闭TCP3001-3003端口"
netsh advfirewall firewall delete rule name="关闭TCP3095-3097端口"
netsh advfirewall firewall delete rule name="关闭TCP389端口"
netsh advfirewall firewall delete rule name="关闭TCP445端口"
netsh advfirewall firewall delete rule name="关闭TCP464端口"
netsh advfirewall firewall delete rule name="关闭TCP593端口"
netsh advfirewall firewall delete rule name="关闭TCP636端口"
netsh advfirewall firewall delete rule name="关闭TCP88端口"
netsh advfirewall firewall delete rule name="关闭UDP1211端口"
netsh advfirewall firewall delete rule name="关闭UDP135端口"
netsh advfirewall firewall delete rule name="关闭UDP137-139端口"
netsh advfirewall firewall delete rule name="关闭UDP445端口"
netsh advfirewall firewall add rule name="开放共享和域的TCP端口" dir=in action=allow protocol=TCP localport="53,88,135,137-139,389,445,464,636,873,1026,3268-3269,49152-65535"
netsh advfirewall firewall add rule name="开放共享和域的UDP端口" dir=in action=allow protocol=UDP localport="53,88,123,135,137-139,389,445,464"
netsh advfirewall firewall add rule name="关闭危险TCP端口" dir=in action=block protocol=TCP localport="593,1025,1720,3001-3003,3095-3097,11211"
netsh advfirewall firewall add rule name="关闭危险UDP端口" dir=in action=block protocol=UDP localport="11211"
netsh ipsec static delete all
rem 删除IP安全策略中的所有的策略、规则、筛选器列表、筛选器、筛选器动作等
netsh ipsec static add policy name=IDC数据中心安全策略
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=88
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=88
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=135
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=135
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=389
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=389
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=464
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=464
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=593
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=636
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=636
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1720
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1025
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3001
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3002
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3003
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3095
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3096
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3097
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filteraction name=阻止 action=block
netsh ipsec static add rule name=关闭端口 policy=IDC数据中心安全策略 filterlist=关闭端口 filteraction=阻止
netsh ipsec static set policy name=IDC数据中心安全策略 assign=y
echo 恢复文件夹右键共享功能菜单
reg add "HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\Directory\background\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\Drive\shellex\PropertySheetHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\LibraryFolder\background\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\UserLibraryFolder\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
echo 如果系统原来没安装SMB1.0功能,可能需要重启服务器
echo 如果没有提示重启服务器,请勿重启
echo 请耐心等待安装共享需要的SMB1.0功能…
powershell Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
pause
goto :wwwpiiscn
:closeSharing
cls
mode 110, 34
title  关闭共享功能[可能需要重启服务器]
echo 关闭Server和TCP/IP NetBIOS Helper服务
net stop LanmanServer /y
sc config LanmanServer start= disabled
net stop lmhosts /y
sc config lmhosts start= disabled
netsh advfirewall set allprofiles state on
rem 开启Windows系统自带的防火墙
netsh advfirewall firewall delete rule name="开放共享和域的TCP端口"
netsh advfirewall firewall delete rule name="开放共享和域的TCP端口"
netsh advfirewall firewall delete rule name="开放打印机TCP端口"
netsh advfirewall firewall delete rule name="开放打印机UDP端口"
netsh advfirewall firewall delete rule name="关闭高危险TCP端口"
netsh advfirewall firewall delete rule name="关闭高危险UDP端口"
netsh advfirewall firewall delete rule name="关闭危险TCP端口"
netsh advfirewall firewall delete rule name="关闭危险UDP端口"
netsh advfirewall firewall delete rule name="关闭TCP1025端口"
netsh advfirewall firewall delete rule name="关闭TCP1211端口"
netsh advfirewall firewall delete rule name="关闭TCP135端口"
netsh advfirewall firewall delete rule name="关闭TCP137-139端口"
netsh advfirewall firewall delete rule name="关闭TCP1720端口"
netsh advfirewall firewall delete rule name="关闭TCP3001-3003端口"
netsh advfirewall firewall delete rule name="关闭TCP3095-3097端口"
netsh advfirewall firewall delete rule name="关闭TCP389端口"
netsh advfirewall firewall delete rule name="关闭TCP445端口"
netsh advfirewall firewall delete rule name="关闭TCP464端口"
netsh advfirewall firewall delete rule name="关闭TCP593端口"
netsh advfirewall firewall delete rule name="关闭TCP636端口"
netsh advfirewall firewall delete rule name="关闭TCP88端口"
netsh advfirewall firewall delete rule name="关闭UDP1211端口"
netsh advfirewall firewall delete rule name="关闭UDP135端口"
netsh advfirewall firewall delete rule name="关闭UDP137-139端口"
netsh advfirewall firewall delete rule name="关闭UDP445端口"
netsh advfirewall firewall add rule name="关闭危险TCP端口" dir=in action=block protocol=TCP localport="593,1025,1720,3001-3003,3095-3097,11211"
netsh advfirewall firewall add rule name="关闭危险UDP端口" dir=in action=block protocol=UDP localport="11211"
netsh advfirewall firewall add rule name="关闭高危险TCP端口" dir=in action=block protocol=TCP localport="88,135,137-139,389,445,464,636"
netsh advfirewall firewall add rule name="关闭高危险UDP端口" dir=in action=block protocol=UDP localport="88,135,137-139,389,445,464,636"
netsh ipsec static delete all
rem 删除IP安全策略中的所有的策略、规则、筛选器列表、筛选器、筛选器动作等
netsh ipsec static add policy name=IDC数据中心安全策略
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=88
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=88
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=135
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=135
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=137
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=137
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=138
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=138
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=139
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=139
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=445
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=445
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=389
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=389
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=464
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=464
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=593
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=636
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=636
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1720
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1025
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3001
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3002
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3003
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3095
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3096
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3097
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filteraction name=阻止 action=block
netsh ipsec static add rule name=关闭端口 policy=IDC数据中心安全策略 filterlist=关闭端口 filteraction=阻止
netsh ipsec static set policy name=IDC数据中心安全策略 assign=y
echo 删除右键共享菜单
reg delete "HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\ModernSharing" /va /f
reg delete "HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Sharing" /va /f
reg delete "HKEY_CLASSES_ROOT\Directory\background\shellex\ContextMenuHandlers\Sharing" /va /f
reg delete "HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\Sharing" /va /f
reg delete "HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\Sharing" /va /f
reg delete "HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\Sharing" /va /f
reg delete "HKEY_CLASSES_ROOT\Drive\shellex\PropertySheetHandlers\Sharing" /va /f
reg delete "HKEY_CLASSES_ROOT\LibraryFolder\background\shellex\ContextMenuHandlers\Sharing" /va /f
reg delete "HKEY_CLASSES_ROOT\UserLibraryFolder\shellex\ContextMenuHandlers\Sharing" /va /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shellex\ContextMenuHandlers\Sharing" /va /f
rem 下面三是Win11和Win2025另有的共享功能项
reg delete "HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\ModernSharing" /va /f
reg delete "HKEY_CLASSES_ROOT\MSGraphDocument\shellex\ContextMenuHandlers\ModernSharing" /va /f
reg delete "HKEY_CLASSES_ROOT\MSGraphDocument_38664959\shellex\ContextMenuHandlers\ModernSharing" /va /f
echo 如果系统原来安装了SMB1.0功能,可能需要重启服务器
echo 如果没有提示重启服务器,请勿重启
echo 请耐心等待禁用SMB1.0功能…
powershell Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
pause
goto :wwwpiiscn

:windowsupdate
cls
mode 110, 34
title 开启或关闭Windows更新功能
echo:
echo         开启或关闭Windows更新功能
echo         ____________________________________________________________
echo:
echo                 [1] 开启Windows更新功能
echo:
echo                 [2] 关闭Windows更新功能
echo                 ____________________________________________
echo:
echo                 [0] 返回
echo         ____________________________________________________________
echo:
echo         请在键盘中输入菜单选项[1,2,0]
choice /C:120 /N
if errorlevel==3  goto :wwwpiiscn
if errorlevel==2  goto :closewindowsupdate
if errorlevel==1  goto :openwindowsupdate
:openwindowsupdate
cls
mode 110, 34
title 开启Windows更新功能
echo 开启"Windows Update"和"更新Orchestrator服务(Update Orchestrator服务)"2个服务
sc config wuauserv start= auto
net start wuauserv
sc config UsoSvc start= demand
rem 手动demand,禁用disabled,自动auto
net start UsoSvc
echo:
echo:
echo 已经开启Windows更新功能,请按任意键返回主菜单…
pause>nul
goto :wwwpiiscn
:closewindowsupdate
cls
mode 110, 34
title 关闭Windows更新功能
net stop wuauserv /y
sc config wuauserv start= disabled
net stop UsoSvc /y
sc config UsoSvc start= demand
net stop BITS /y
sc config BITS start= disabled
rem 停止并禁用后台智能传输服务"Background Intelligent Transfer Service",不影响手动更新
echo:
echo:
echo 已经关闭Windows更新功能,请按任意键返回主菜单…
pause>nul
goto :wwwpiiscn

:thumbnail
cls
mode 110, 34
title 开启或关闭系统缩略图功能
echo:
echo         开启或关闭系统显示缩略图功能
echo         ____________________________________________________________
echo:
echo                 [1] 开启系统显示缩略图【重启后生效】
echo:
echo                 [2] 关闭系统显示缩略图【重启后生效】
echo                 ____________________________________________
echo:
echo                 [0] 返回
echo         ____________________________________________________________
echo:
echo         请在键盘中输入菜单选项[1,2,0]
choice /C:120 /N
if errorlevel==3  goto :wwwpiiscn
if errorlevel==2  goto :closethumbnail
if errorlevel==1  goto :openthumbnail
:openthumbnail
cls
mode 110, 34
title 开启系统显示缩略图功能
echo 开启系统显示缩略图【重启后生效】
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "DisableThumbnails" /t REG_DWORD /d 0 /f
rem 或者reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "DisableThumbnails" /f
echo:
echo:
echo 已开启系统显示缩略图[重启后生效],请按任意键返回主菜单…
pause>nul
goto :wwwpiiscn
:closethumbnail
cls
mode 110, 34
title 关闭系统显示缩略图功能
echo 关闭系统显示缩略图【重启后生效】
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "DisableThumbnails" /t REG_DWORD /d 1 /f
echo:
echo:
echo 已关闭系统显示缩略图[重启后生效],请按任意键返回主菜单…
pause>nul
goto :wwwpiiscn

:openPrint
cls
mode 110, 34
title  开启打印机服务
echo 开启Print Spooler打印机服务
sc config spooler start= auto
net start spooler
echo:
echo:
echo 已开启Print Spooler打印机服务,请按任意键返回主菜单…
pause>nul
goto :wwwpiiscn

:closePrint
cls
mode 110, 34
title  关闭打印机服务
echo 关闭Print Spooler打印机服务
net stop spooler /y
sc config spooler start= disabled
echo:
echo:
echo 已关闭Print Spooler打印机服务,请按任意键返回主菜单…
pause>nul
goto :wwwpiiscn

:openPrintPort
cls
mode 110, 34
title 打开打印机共享端口[打印机不在局域网中共享请勿打开]
echo:
echo         打印机不在局域网中共享请勿打开
echo         ____________________________________________________________
echo:
echo                 [1] 打开打印机共享需要的端口
echo:
echo                 [2] 关闭系统共享功能【含打印机共享】
echo                 ____________________________________________
echo:
echo                 [0] 返回
echo         ____________________________________________________________
echo:
echo         请在键盘中输入菜单选项[1,2,0]
choice /C:120 /N
if errorlevel==3  goto :wwwpiiscn
if errorlevel==2  goto :closeSharing
if errorlevel==1  goto :openPrintPort2
:openPrintPort2
echo 设置Print Spooler打印机服务为自动
sc config spooler start= auto
net start spooler
netsh advfirewall set allprofiles state on
rem 开启Windows系统自带的防火墙
netsh advfirewall firewall delete rule name="开放共享和域的TCP端口"
netsh advfirewall firewall delete rule name="开放共享和域的TCP端口"
netsh advfirewall firewall delete rule name="开放打印机TCP端口"
netsh advfirewall firewall delete rule name="开放打印机UDP端口"
netsh advfirewall firewall delete rule name="关闭高危险TCP端口"
netsh advfirewall firewall delete rule name="关闭高危险UDP端口"
netsh advfirewall firewall delete rule name="关闭危险TCP端口"
netsh advfirewall firewall delete rule name="关闭危险UDP端口"
netsh advfirewall firewall delete rule name="关闭TCP1025端口"
netsh advfirewall firewall delete rule name="关闭TCP1211端口"
netsh advfirewall firewall delete rule name="关闭TCP135端口"
netsh advfirewall firewall delete rule name="关闭TCP137-139端口"
netsh advfirewall firewall delete rule name="关闭TCP1720端口"
netsh advfirewall firewall delete rule name="关闭TCP3001-3003端口"
netsh advfirewall firewall delete rule name="关闭TCP3095-3097端口"
netsh advfirewall firewall delete rule name="关闭TCP389端口"
netsh advfirewall firewall delete rule name="关闭TCP445端口"
netsh advfirewall firewall delete rule name="关闭TCP464端口"
netsh advfirewall firewall delete rule name="关闭TCP593端口"
netsh advfirewall firewall delete rule name="关闭TCP636端口"
netsh advfirewall firewall delete rule name="关闭TCP88端口"
netsh advfirewall firewall delete rule name="关闭UDP1211端口"
netsh advfirewall firewall delete rule name="关闭UDP135端口"
netsh advfirewall firewall delete rule name="关闭UDP137-139端口"
netsh advfirewall firewall delete rule name="关闭UDP445端口"
netsh advfirewall firewall add rule name="开放共享和域的TCP端口" dir=in action=allow protocol=TCP localport="53,88,135,137-139,389,445,464,636,873,1026,3268-3269,49152-65535"
netsh advfirewall firewall add rule name="开放共享和域的UDP端口" dir=in action=allow protocol=UDP localport="53,88,123,135,137-139,389,445,464"
netsh advfirewall firewall add rule name="开放打印机TCP端口" dir=in action=allow protocol=TCP localport="9100-9102,9220-9222,9280-9282,9290-9292"
netsh advfirewall firewall add rule name="开放打印机UDP端口" dir=in action=allow protocol=UDP localport="105,5353"
netsh advfirewall firewall add rule name="关闭危险TCP端口" dir=in action=block protocol=TCP localport="593,1025,1720,3001-3003,3095-3097,11211"
netsh advfirewall firewall add rule name="关闭危险UDP端口" dir=in action=block protocol=UDP localport="11211"
netsh ipsec static delete all
rem 删除IP安全策略中的所有的策略、规则、筛选器列表、筛选器、筛选器动作等
netsh ipsec static add policy name=IDC数据中心安全策略
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=88
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=88
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=135
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=135
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=389
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=389
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=464
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=464
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=593
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=636
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=636
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1720
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1025
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3001
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3002
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3003
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3095
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3096
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3097
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filteraction name=阻止 action=block
netsh ipsec static add rule name=关闭端口 policy=IDC数据中心安全策略 filterlist=关闭端口 filteraction=阻止
netsh ipsec static set policy name=IDC数据中心安全策略 assign=y
echo 恢复文件夹右键共享功能菜单
reg add "HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\Directory\background\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\Directory\shellex\PropertySheetHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\Drive\shellex\PropertySheetHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\LibraryFolder\background\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_CLASSES_ROOT\UserLibraryFolder\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shellex\ContextMenuHandlers\Sharing" /ve /t REG_SZ /d "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" /f
echo 如果系统原来没安装SMB1.0功能,可能需要重启服务器
echo 如果没有提示重启服务器,请勿重启
echo 请耐心等待安装共享需要的SMB1.0功能…
powershell Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
echo:
echo:
echo 已打开打印机共享需要的端口,请在共享中手动设置需要共享的打印机
echo 按任意键返回主菜单…
pause>nul
goto :wwwpiiscn

:openActiveDirectory
cls
mode 110, 34
title 安装Active Directory域控制器
echo:
echo         安装Active Directory域控制器
echo         ____________________________________________________________
echo:
echo                 [1] 请先开启共享功能[安装AD域前提条件]
echo:
echo                 [2] 安装Active Directory域控制器并开放端口
echo:
echo                 [3] AD域控服务器安全加固【执行前2项后再操作】
echo                 ____________________________________________
echo:
echo                 [0] 返回
echo         ____________________________________________________________
echo:
echo         请在键盘中输入菜单选项[1,2,3,0]
choice /C:1230 /N
if errorlevel==4  goto :wwwpiiscn
if errorlevel==3  goto :ADacceptip
if errorlevel==2  goto :openActiveDirectory2
if errorlevel==1  goto :openSharing2
:openActiveDirectory2
cls
mode 110, 34
title  安装Active Directory域控制器
echo 开启Active Directory域控制器需要的服务
sc config LanmanServer start= auto
net start LanmanServer
sc config RemoteRegistry start= auto
net start RemoteRegistry
sc config lmhosts start= auto
net start lmhosts
sc config Browser start= auto
net start Browser
sc config RpcSs start= auto
net start RpcSs
sc config LanmanWorkstation start= auto
net start LanmanWorkstation
sc config VSS start= auto
net start VSS
netsh advfirewall set allprofiles state on
rem 开启Windows系统自带的防火墙
netsh advfirewall firewall delete rule name="开放共享和域的TCP端口"
netsh advfirewall firewall delete rule name="开放共享和域的TCP端口"
netsh advfirewall firewall delete rule name="开放打印机TCP端口"
netsh advfirewall firewall delete rule name="开放打印机UDP端口"
netsh advfirewall firewall delete rule name="关闭高危险TCP端口"
netsh advfirewall firewall delete rule name="关闭高危险UDP端口"
netsh advfirewall firewall delete rule name="关闭危险TCP端口"
netsh advfirewall firewall delete rule name="关闭危险UDP端口"
netsh advfirewall firewall delete rule name="关闭TCP1025端口"
netsh advfirewall firewall delete rule name="关闭TCP1211端口"
netsh advfirewall firewall delete rule name="关闭TCP135端口"
netsh advfirewall firewall delete rule name="关闭TCP137-139端口"
netsh advfirewall firewall delete rule name="关闭TCP1720端口"
netsh advfirewall firewall delete rule name="关闭TCP3001-3003端口"
netsh advfirewall firewall delete rule name="关闭TCP3095-3097端口"
netsh advfirewall firewall delete rule name="关闭TCP389端口"
netsh advfirewall firewall delete rule name="关闭TCP445端口"
netsh advfirewall firewall delete rule name="关闭TCP464端口"
netsh advfirewall firewall delete rule name="关闭TCP593端口"
netsh advfirewall firewall delete rule name="关闭TCP636端口"
netsh advfirewall firewall delete rule name="关闭TCP88端口"
netsh advfirewall firewall delete rule name="关闭UDP1211端口"
netsh advfirewall firewall delete rule name="关闭UDP135端口"
netsh advfirewall firewall delete rule name="关闭UDP137-139端口"
netsh advfirewall firewall delete rule name="关闭UDP445端口"
netsh advfirewall firewall add rule name="开放共享和域的TCP端口" dir=in action=allow protocol=TCP localport="53,88,135,137-139,389,445,464,636,873,1026,3268-3269,49152-65535"
netsh advfirewall firewall add rule name="开放共享和域的UDP端口" dir=in action=allow protocol=UDP localport="53,88,123,135,137-139,389,445,464"
netsh advfirewall firewall add rule name="开放打印机TCP端口" dir=in action=allow protocol=TCP localport="9100-9102,9220-9222,9280-9282,9290-9292"
netsh advfirewall firewall add rule name="开放打印机UDP端口" dir=in action=allow protocol=UDP localport="105,5353"
netsh advfirewall firewall add rule name="关闭危险TCP端口" dir=in action=block protocol=TCP localport="593,1025,1720,3001-3003,3095-3097,11211"
netsh advfirewall firewall add rule name="关闭危险UDP端口" dir=in action=block protocol=UDP localport="11211"
netsh ipsec static delete all
rem 删除IP安全策略中的所有的策略、规则、筛选器列表、筛选器、筛选器动作等
netsh ipsec static add policy name=IDC数据中心安全策略
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=593
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1720
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1025
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3001
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3002
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3003
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3095
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3096
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3097
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filteraction name=阻止 action=block
netsh ipsec static add rule name=关闭端口 policy=IDC数据中心安全策略 filterlist=关闭端口 filteraction=阻止
netsh ipsec static set policy name=IDC数据中心安全策略 assign=y
echo 请耐心等待安装Active Directory域控制器…
powershell -command Add-WindowsFeature  AD-Domain-Services,RSAT-AD-Tools,RSAT-ADDS,RSAT-AD-AdminCenter,RSAT-ADDS-Tools,RSAT-ADLDS,RSAT-AD-PowerShell,GPMC
echo:
echo:
echo 请手动检查:网络设置-网卡属性-Internet协议版本4(TCP/IP4)-高级-WINS-启用TCP/IP上的NetBIOS
echo 正常情况下NetBIOS默认是启动状态
echo 已安装Active Directory域控制器并开放相关端口,请按任意键返回主菜单…
pause>nul
goto :wwwpiiscn

:ActiveDirectoryPort
cls
mode 110, 34
title 作为客户机加入域环境开放端口[客户机无需装域控]
echo:
echo         作为客户机加入域环境开放端口
echo         ____________________________________________________________
echo:
echo                 [1] 请先开启共享功能[加入AD域前提条件]
echo:
echo                 [2] 作为客户机加入域环境开放端口
echo:
echo                 [3] 域成员客户机安全加固【执行前2项后再操作】
echo                 ____________________________________________
echo:
echo                 [0] 返回
echo         ____________________________________________________________
echo:
echo         请在键盘中输入菜单选项[1,2,3,0]
choice /C:1230 /N
if errorlevel==4  goto :wwwpiiscn
if errorlevel==3  goto :ADacceptip
if errorlevel==2  goto :ActiveDirectoryPort2
if errorlevel==1  goto :openSharing2
:ActiveDirectoryPort2
cls
mode 110, 34
title  作为客户机加入域环境开放相关端口
echo 开启域客户机所需要的服务
sc config LanmanServer start= auto
net start LanmanServer
sc config RemoteRegistry start= auto
net start RemoteRegistry
sc config lmhosts start= auto
net start lmhosts
sc config Browser start= auto
net start Browser
sc config RpcSs start= auto
net start RpcSs
sc config LanmanWorkstation start= auto
net start LanmanWorkstation
sc config VSS start= auto
net start VSS
netsh advfirewall set allprofiles state on
rem 开启Windows系统自带的防火墙
netsh advfirewall firewall delete rule name="开放共享和域的TCP端口"
netsh advfirewall firewall delete rule name="开放共享和域的TCP端口"
netsh advfirewall firewall delete rule name="开放打印机TCP端口"
netsh advfirewall firewall delete rule name="开放打印机UDP端口"
netsh advfirewall firewall delete rule name="关闭高危险TCP端口"
netsh advfirewall firewall delete rule name="关闭高危险UDP端口"
netsh advfirewall firewall delete rule name="关闭危险TCP端口"
netsh advfirewall firewall delete rule name="关闭危险UDP端口"
netsh advfirewall firewall delete rule name="关闭TCP1025端口"
netsh advfirewall firewall delete rule name="关闭TCP1211端口"
netsh advfirewall firewall delete rule name="关闭TCP135端口"
netsh advfirewall firewall delete rule name="关闭TCP137-139端口"
netsh advfirewall firewall delete rule name="关闭TCP1720端口"
netsh advfirewall firewall delete rule name="关闭TCP3001-3003端口"
netsh advfirewall firewall delete rule name="关闭TCP3095-3097端口"
netsh advfirewall firewall delete rule name="关闭TCP389端口"
netsh advfirewall firewall delete rule name="关闭TCP445端口"
netsh advfirewall firewall delete rule name="关闭TCP464端口"
netsh advfirewall firewall delete rule name="关闭TCP593端口"
netsh advfirewall firewall delete rule name="关闭TCP636端口"
netsh advfirewall firewall delete rule name="关闭TCP88端口"
netsh advfirewall firewall delete rule name="关闭UDP1211端口"
netsh advfirewall firewall delete rule name="关闭UDP135端口"
netsh advfirewall firewall delete rule name="关闭UDP137-139端口"
netsh advfirewall firewall delete rule name="关闭UDP445端口"
netsh advfirewall firewall add rule name="开放共享和域的TCP端口" dir=in action=allow protocol=TCP localport="53,88,135,137-139,389,445,464,636,873,1026,3268-3269,49152-65535"
netsh advfirewall firewall add rule name="开放共享和域的UDP端口" dir=in action=allow protocol=UDP localport="53,88,123,135,137-139,389,445,464"
netsh advfirewall firewall add rule name="开放打印机TCP端口" dir=in action=allow protocol=TCP localport="9100-9102,9220-9222,9280-9282,9290-9292"
netsh advfirewall firewall add rule name="开放打印机UDP端口" dir=in action=allow protocol=UDP localport="105,5353"
netsh advfirewall firewall add rule name="关闭危险TCP端口" dir=in action=block protocol=TCP localport="593,1025,1720,3001-3003,3095-3097,11211"
netsh advfirewall firewall add rule name="关闭危险UDP端口" dir=in action=block protocol=UDP localport="11211"
netsh ipsec static delete all
rem 删除IP安全策略中的所有的策略、规则、筛选器列表、筛选器、筛选器动作等
netsh ipsec static add policy name=IDC数据中心安全策略
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=593
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1720
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1025
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3001
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3002
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3003
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3095
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3096
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3097
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filteraction name=阻止 action=block
netsh ipsec static add rule name=关闭端口 policy=IDC数据中心安全策略 filterlist=关闭端口 filteraction=阻止
netsh ipsec static set policy name=IDC数据中心安全策略 assign=y
echo 请手动检查:网络设置-网卡属性-Internet协议版本4(TCP/IP4)-高级-WINS-启用TCP/IP上的NetBIOS
echo 正常情况下NetBIOS默认是启动状态
echo 加入域环境所需要的端口已开启,请手动将本机加入到您的域环境中
echo 请按任意键返回主菜单…
pause>nul
goto :wwwpiiscn

:ADacceptip
cls
mode 110, 34
title 域环境安全加固
echo:
echo         域环境安全加固【注意先后顺序,请先执行1次[1]再反复执行[2]】
echo         ____________________________________________________________
echo:
echo                 [1] 禁止外部访问本机域业务端口【执行1次即可,会清除所有授权】
echo:
echo                 [2] 授权域成员IP能访问本机域业务端口【需先执行1次[1]】
echo:
echo                 [3] 删除已授权IP访问本机域业务端口【IP已不在域中使用时】
echo                 ____________________________________________
echo:
echo                 [0] 返回
echo         ____________________________________________________________
echo:
echo         请在键盘中输入菜单选项[1,2,3,0]
choice /C:1230 /N
if errorlevel==4  goto :wwwpiiscn
if errorlevel==3  goto :ADacceptip3
if errorlevel==2  goto :ADacceptip2
if errorlevel==1  goto :ADacceptip1
:ADacceptip1
cls
mode 110, 34
title  设置域环境中业务端口禁止外部访问
echo 设置域环境中业务端口禁止外部访问
netsh ipsec static delete all
rem 删除IP安全策略中的所有的策略、规则、筛选器列表、筛选器、筛选器动作等
netsh ipsec static add policy name=IDC数据中心安全策略
netsh ipsec static add filterlist 关闭端口
netsh ipsec static add filteraction name=阻止 action=block
netsh ipsec static add filterlist 许可端口
netsh ipsec static add filteraction name=许可 action=permit
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=88
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=88
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=135
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=135
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=137
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=137
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=138
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=138
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=139
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=139
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=445
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=445
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=389
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=389
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=464
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=464
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=593
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=636
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=636
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=860
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1720
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=1025
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=2049
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=2049
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3001
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3002
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3003
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3095
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3096
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3097
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3260
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3261
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3262
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3263
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3264
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=3265
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add filter filterlist=关闭端口 srcaddr=any dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=11211
netsh ipsec static add rule name=关闭端口 policy=IDC数据中心安全策略 filterlist=关闭端口 filteraction=阻止
netsh ipsec static add filter filterlist=许可端口 srcaddr=127.0.0.1 dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=80
rem 建立上面这条许可规则是为了增加筛选列表,后面会删除这条规则
netsh ipsec static add rule name=许可端口 policy=IDC数据中心安全策略 filterlist=许可端口 filteraction=许可
netsh ipsec static set policy name=IDC数据中心安全策略 assign=y
netsh ipsec static delete filter filterlist=许可端口 srcaddr=127.0.0.1 dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=80
rem 删除前面建立的一个辅助规则
echo:
echo:
echo 已禁止本机域业务端口外部访问
echo 请尽快授权域成员IP访问本机的域业务端口
echo 在域成员全部服务器上都需要授权除自身IP外的成员IP能访问
echo 请按任意键去授权域控和域客户机的IP能访问业务端口…
pause>nul
goto :ADacceptip
:ADacceptip2
cls
mode 110, 34
title  授权域控和域客户机的IP能访问业务端口
echo 授权域控和域客户机的IP能访问业务端口
echo 在域成员全部服务器上都需要授权除自身IP外的成员IP能访问
echo 请在域控机和域客户机将域成员IP加入进来,每次输入一个IP
set /p  acceptip=请输入域控和域客户机的IP并按回车(每次输入1个IP):
for  %%i in (
88
135
137
138
139
445
389
464
636
860
2049
3260
3261
3262
3263
3264
3265
) do netsh ipsec static add filter filterlist=许可端口 srcaddr=%acceptip% dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=%%i && netsh ipsec static add filter filterlist=许可端口 srcaddr=%acceptip% dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=%%i
echo:
echo:
echo 已授权%acceptip%访问域业务端口
echo 请在域控机和域客户机反复操作将域成员的IP加入进来
echo 在域成员全部服务器上都需要授权除自己IP外的成员IP访问
echo 请按任意键再次授权域控和域客户机的剩下IP能访问业务端口…
pause>nul
goto :ADacceptip
:ADacceptip3
cls
mode 110, 34
title  删除已授权IP访问域业务端口
echo 删除已授权IP访问域业务端口
echo 除非此IP已经不在域成员中使用,否则请不要删除
set /p  acceptip=请输入需要删除的授权IP并按回车(每次输入1个IP):
for  %%i in (
88
135
137
138
139
445
389
464
636
860
2049
3260
3261
3262
3263
3264
3265
) do netsh ipsec static delete filter filterlist=许可端口 srcaddr=%acceptip% dstaddr=me protocol=TCP mirrored=yes srcport=0 dstport=%%i && netsh ipsec static delete filter filterlist=许可端口 srcaddr=%acceptip% dstaddr=me protocol=UDP mirrored=yes srcport=0 dstport=%%i
echo:
echo:
echo 已删除%acceptip%访问本机域业务端口
echo 除非此IP已经不在域成员中使用,否则请不要删除
echo 如果错误删除IP,再次加入即可
echo 请按任意键返回…
pause>nul
goto :ADacceptip
 

迅恒运营的IDC数据中心机房介绍
机房名称 机房介绍 是否推荐
广州较场西路机房 中国电信5星级机房,华南骨干出口,广州市中心机房,交通便利,总带宽200G,为华南骨干出口。
广州人民中路机房 中国电信3星级机房,超高速的20Gx2主备双线路带宽直接接入ChinaNET骨干层。
广州天河科技园机房 天河软件园建中路4号,中国互联网应急中心机房,国家政府机关直属。多线接入骨干BGP线路。
电子商务部广州机房 天河软件建业路上(科韵路)的国际电子商务中心大厦甲级写字楼内,机房环境一流。多线接入骨干BGP线路。
广州电信加速器机房 位于广州市萝岗区开源大道1号企业加速器B1栋一楼,按照国际T3+及国标B+级标准建造,机房环境一流。多线接入骨干网。
广州移动旗锐机房 广州科学城南翔二路1号旗锐数字科技园区内,属于第三方私立机房,现由移动运营,从粤西汇聚节点直连CMNET骨干网。
广州移动南方基地机房 中国移动广州南方基地机房位于广州市天河软件园高塘大道333号,用于移动骨干网线路,是移动服务器托管优质机房。
东莞电信道滘机房 中国电信4星级机房,总带宽320G,可提供电信和多线BGP线路,华南骨干机房,稳定高速,性价比高。
东莞电信东城机房 中国电信4星级机房,总带宽320G,性价比高,可提供电信和多线BGP线路和200G集群硬件防火墙VIP防护。
东莞电信樟木头机房 中国电信4星级机房,总带宽320G,可提供电信和多线BGP线路和100G集群硬件防火墙企业级防护。
深圳互联港湾机房 深圳南山高新区中区软件大厦四楼,电信3星级机房,20G带宽接入骨干网络。
深圳南山科兴机房 位于深圳市南山区科技园科苑路15号科兴科学园,3星级机房,可提供双线接入等业务。
深圳百旺信机房 深圳市南山区西丽松白公路百旺信工业区A区(一区)一栋属于第三方机房,可提供双线接入等业务。
佛山电信信息大厦机房 佛山市汾江南路35号电信佛山分公司信息大厦8-9层,是中国电信3星级机房,可提供双线接入等业务。
中山电信火炬机房 机房位于中山市火炬区康乐大道47号电信3楼,是中国电信3星级机房,可提供双线接入等业务。
江苏徐州电信机房 机房位于江苏徐州市新城区镜泊东路4号,徐州市档案馆东侧,是中国电信3星级机房,可提供双线接入等业务。
江苏常州电信机房 机房位于江苏省常州市清凉路108号常州信息港,是中国电信4星级机房,可提供双线接入等业务。
香港TKO机房 机房靠近香港交易所的数据中心位置和香港商业中心,拥有PCCW、GTT、Cogent、Telia、TATA、CT、CN2、CU线路。
香港将军澳机房 机房在香港新界將軍澳工業邨駿昌街22號,与阿里云香港机房同属一栋楼,拥有多种线路接入。
香港新世界机房 香港新世界机房的海底电缆系统遍布全球,能直接连接多个国家,免备案,服务器租用、云服务器等业务。
香港NTT机房 香港NTT电讯机房,是一座专用数据中心,在香港大埔,免备案,提供服务器租用、VPS云服务器等业务。
美国洛杉矶机房 位于美国洛杉矶,直连全球,是全球带宽最集中的地方,是外贸企业首选,该机房只提供服务器租用业务。
美国加州DCS机房 位于美国加州,直连全球,是美国的华人机房,是外贸企业首选,该机房只提供服务器租用业务。
美国圣何塞机房 位于美国圣何塞,紧邻科技中心-硅谷,直连全球,是外贸企业首选,该机房只提供服务器租用业务。
韩国首尔KT机房 韩国首尔的江南区道谷洞数据中心,光纤直连电信(CN2)、移动、PCCW、NTT等网络核心骨干。
台湾中华电信机房 台湾中华电信机房位于台湾台北市114内湖区瑞光路68号3楼,是台湾对外最重要的电信枢纽之一。
菲律宾PLDT机房 菲律宾PLDT机房拥有PCCW、TATA、CT、CN2等线路接入,优化线路到中国大陆速度快,延迟低,网络稳定。
迅恒十多年IT企业和IDC运维经验为您提供优质服务
迅恒专注网站建设10多年,几十人技术团队,品质卓越,服务有保障!
  • 云虚拟主机

    ¥99元/年起 网站空间 原价:199元

  • 独立物理服务器

    ¥488/月起 物理机 原价:699元

  • 网站建设

    ¥580企业建站 原价:1999元起

    迅恒建站·ABOUT US

    迅恒专注于企业建站,海量精美网站风格模板供您选择!

广州网站设计公司哪家好

    建站流程·PROCEDURE

    网络营销推广的第一步就是做一个属于自己的网站

  • 沟通联系

    提出需求,咨询报价
  • 达成协议

    交流达成详细建站协议
  • 支付费用

    支付建站相关费用
  • 建站开发

    根据客户需求,制作网站
  • 验收

    客户验收网站
  • 提交上线

    验收合格,解析域名上线
  • 售后服务

    一对一的售后服务客服
    • 我们的优势·OUR STRENGTHS

      做网站,为什么要选迅恒建站?

  • 技术团队

    专业的设计团队、技术团队,为客户提供专业的技术服务支持

  • 源码交付

    客户查验合格,提供源码交付/FTP信息。网站商业授权,避免产权纠纷

  • 四合一建站多终端展示

    网站能够在CP+平板+手机+小程序 完美响应展示。

  • 无隐形收费

    所有收费项公开透明,正规签订合同,合同清楚明确

  • 高端设计

    提供网站个性化定制设计,拒绝千篇一律

  • 安全稳定

    我司与华为云/腾讯云长期合作,采用安全稳定服务器,保障网站安全稳定运行

  • 迅恒累计为上万网站稳定运行 100000000
    机房接入电信带宽400G、联通带宽200G、移动带宽100G,直连核心骨干网络;
    所有重要网络节点和核心设备均采用华为电信级交换设备,网络总体交换能力高达684G,网络联通率达到99.99%,
    并且多点冗余备份,提高网络性能,避免单点故障。
  • 快速导航
  • 广州迅恒信息科技有限公司:
  • 增值电信业务经营许可证和ICP备案 粤B2-20061054
  • 公司业务咨询电话:
  • 020-82315523
  • 公司企业QQ/商务QQ:
  • 923109991 16764407 20300996
  • 销售经理:18988993510 13533213185
  • 备案咨询和售后服务电话:18988993505
  • 专注广州服务器托管
    请加销售经理微信
    Copyright 2005-2020 迅恒 版权所有   公司地址:广州市天河区中山大道中路77号  广州机房:较长西路21号广州电信超级信息港 香港机房:香港新界葵涌葵丰街钟意恒胜中心  粤公网安备44010602002183