我有一個PowerShell腳本,打開端口5555,但它默認爲配置文件=私人,當我希望它是所有(私人,公共,域)。我如何修改腳本來實現這一目標?Powershell打開端口配置文件,所有(私有公共域)
$port = New-Object -ComObject HNetCfg.FWOpenPort
$port.Port = 5555
$port.Name = 'MyPort'
$port.Enabled = $true
$fwMgr = New-Object -ComObject HNetCfg.FwMgr
$profile = $fwMgr.LocalPolicy.CurrentProfile
$profile.GloballyOpenPorts.Add($port)
$port = New-Object -ComObject HNetCfg.FWOpenPort
$port.Port = 6521
$port.Name = 'ArkleSQL'
$port.Enabled = $true
$fwMgr = New-Object -ComObject HNetCfg.FwMgr
$profile = $fwMgr.LocalPolicy.CurrentProfile
$profile.GloballyOpenPorts.Add($port)