Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Powershell在DMZ上创建网络共享,防火墙规则?_Powershell_Firewall - Fatal编程技术网

使用Powershell在DMZ上创建网络共享,防火墙规则?

使用Powershell在DMZ上创建网络共享,防火墙规则?,powershell,firewall,Powershell,Firewall,我正在尝试使用powershell在位于DMZ(已完全锁定)上的服务器上创建一个网络共享文件夹,并已请求在防火墙中设置一个规则,以允许TCP端口445发生这种情况,但powershell使用的协议和端口是否正确 我有下面的脚本,我用它在域服务器上创建文件夹,它工作得很好 If (!(Test-Path -Path $dirpath)) { Write-Host "Creating share: $dirpath" New-Item $dirpath -Type dir

我正在尝试使用powershell在位于DMZ(已完全锁定)上的服务器上创建一个网络共享文件夹,并已请求在防火墙中设置一个规则,以允许TCP端口445发生这种情况,但powershell使用的协议和端口是否正确

我有下面的脚本,我用它在域服务器上创建文件夹,它工作得很好

  If (!(Test-Path -Path $dirpath))
  {
     Write-Host "Creating share: $dirpath"
     New-Item $dirpath -Type directory
     ForEach ($user In $accesslist)
     {
        Set-FullControl -Principal $user -Folder $dirpath
     }
  }
  Else
  {
     Write-Host "Folder $dirpath already exists" -Foreground Green
  }
其中$dirpath可以是\SERVENAME\d$\folder

但我不确定我需要设置什么防火墙规则才能在DMZ服务器上实现这一点,防火墙需要允许什么通过


设置共享后,我复制安装文件并再次执行安装(windows服务)。所有这些都是使用powershell完成的。

445只是smb所需的端口之一,您还需要137-139。除此之外,您显然还需要适当的权限