✏️ 正在编辑: enable_winexe.ps1
路径:
/var/opt/nydus/ops/customer_local_ops/operating_system/powershell/enable_winexe.ps1
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
function Ensure-NetFirewallRule { param($displayName, $direction, $action, $protocol, $localPort) if(Get-NetFirewallRule -DisplayName $displayName -ea SilentlyContinue){ Remove-NetFirewallRule -DisplayName $displayName } New-NetFirewallRule -DisplayName $displayName -Direction $direction -Action $action -Protocol $protocol -LocalPort $localPort } Enable-PSRemoting -Force "Configuring firewall" Ensure-NetFirewallRule -DisplayName "winexe" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 139 netsh advfirewall firewall set rule name=winexe new localport=139,445 # Remove the blocks set up in the image by OH. NOTE: The spaces in the rule names are required. That's how # the rules were created. Remove-NetFirewallRule -DisplayName "Block TCP 139 " -ea SilentlyContinue Remove-NetFirewallRule -DisplayName "Block TCP 445 " -ea SilentlyContinue "Auto-restart Lanman Server on failure" sc.exe failure LanManServer reset= 3600 actions= restart/5000/restart/10000/restart/5000 "Fix Lanman Server dependencies" # SamSS=Security Accounts Manager; Srv2=SMB2 driver sc.exe config lanmanserver depend= SamSS/Srv2 sc.exe start lanmanserver
💾 保存文件
← 返回文件管理器