All Questions
Tagged with firewall powershell
69 questions
1
vote
1
answer
50
views
How to get a list of recent firewall changes and the details using powershell?
I would like to have a list of recent firewall changes (as is often made by installing software), and see the details of the firewall change that was made.
I managed to get a list within a certain ...
0
votes
1
answer
37
views
Create rule with New-NetFirewallRule and get LocalPort value of the rule created
When creating Windows Firewall rule with New-NetFirewallRule, it returns some data about rule created:
PS C:\> New-NetFirewallRule -DisplayName "Allow debug rule" -Direction inbound -...
-1
votes
2
answers
230
views
Determine if a firewall rule with a certain name exists
Simple question, how to compose an if else expression if a firewall rule named "rule X" exists? I found a dozen different examples, but they were either not working or too abstruse.
$r = Get-...
0
votes
1
answer
152
views
Azure powershell provision sftp storage with Basic Firewall
I hope somebody can help me to solve this issue as i am loosing my mind and patience with it.
Following this microsoft documentation on how to provision an SFTP platform using an azure firewall and ...
0
votes
1
answer
799
views
How do I enable the high level "public" and "private" network access settings in Windows Defender via Powershell?
I see that I can create firewall rules, and I am sure that some configuration of New-NetFirewallRule for a particular app can duplicate the behavior of enabling the App's access to public and private ...
0
votes
0
answers
73
views
Not able to run Add-WindowsFeature NET-Framework-Features
As part of automation of I am running the command Add-WindowsFeature NET-Framework-Features using PowerShell with elevated permission (As admin) but its keep on failing with error. I know this command ...
0
votes
1
answer
1k
views
Check RAM, CPU usage and Disk space from a remote computer
Using WMI (https://en.wikipedia.org/wiki/Windows_Management_Instrumentation) I wrote a powershell to monitor Ram, CPU and CPU usage of a remote computer like the following:
$CompObject = Get-...
1
vote
1
answer
272
views
One or more essential parameters were not entered powershell
I have an existing Outbound Rule in my firewall with a set of specified IP addresses. For enhanced security, I want to append additional IP addresses to this rule using a shell script. I am trying to ...
0
votes
0
answers
181
views
Remove-NetFireWallRule Does Nothing?
I'm running this Powershell command to remove a Firewall rule:
Remove-NetFireWallRule -DisplayName 'PPGooey (In) [7e3458172fa1a7e5b36fa09552dee4f9]'
and it doesn't cough up any error, nor does it ...
0
votes
1
answer
374
views
Powershell error when running Azure AD cmdlets
I am running the normal AzureAD commands from a new Azure VM which is behind firewall . I believe the required firewall ports are open to login.microsoftonline.com but cannot say for sure with the ...
1
vote
1
answer
57
views
How can I assign the "Action=Allow" command after the "Delete Firewall Rule" command assigned to the right button?
There is a Context Menu that I have assigned to the right mouse button as Windows Firewall. And I am using the following code to delete a security rule.
Windows Registry Editor Version 5.00
[...
1
vote
1
answer
982
views
How do I make the "Firewall Rule Delete" command assigned to the right mouse button detect the path of the file?
I have created a custom property for the right button menu that allows me to "Firewall Rule" any file in Windows 10 and block its internet access.
Similarly, I have another property that can ...
0
votes
1
answer
571
views
discovery if ICMPv4 inbound is allowed on firewall
Trying to list ICMPv4 Inbound Allowed rule on windows firewall (to process in batch/ps hybrid script)
powershell.exe "Get-NetFirewallPortFilter -Protocol icmpv4 | Get-NetFirewallRule | ft enabled,...
1
vote
1
answer
304
views
PowerShell code to tie a firewall rule to a WindowsApps executable on Windows 10
I need to come up with PowerShell code that puts a firewall rule in place, where this rule is tied to an executable that, in its turn, comes from an installed AppX package. The executable, thus, sits ...
2
votes
1
answer
3k
views
PowerShell find firewall rule by displayname, port, direction and protocol
Get-NetFirewallRule only gets you the displayname.
Get-NetFirewallPortFilter only gets you the protocol and port.
What about direction?
How to combine them together?
Get-NetFireallrule -displayname &...
0
votes
1
answer
148
views
Script command won't accept results of array -join but will accept it when typed in manually
I'm adding firewall rules via powershell script. When the script only wants to open a single port (i.e. when $ports=@(80) below) it seems to work fine, but I want to open multiple ports by putting ...
0
votes
1
answer
466
views
Win 2008 - MSI installer fails with firewall exception
OS: Windows 2008 R2
Zabbix Agent 2 - 6.2.5
As admin, when installing Zabbix Agent 2 MSI package with a PowerShell script, I'm getting what seems to be a firewall exception. That causes MSI installer ...
0
votes
0
answers
2k
views
How can I check if Firewall rule exists before adding a new one using Powershell?
Here is my code:
$rules = Get-NetFirewallRule
$par = @{
DisplayName = "Block appvlp.exe netconns"
Direction="Outbound"
Protocol ="TCP"
Action = "...
0
votes
1
answer
700
views
Need help to add rule in Azure Firewall Powershell
I am trying to add a rule in azure firewall. I have azure firewall policy where I have create network rule collection then inside the collection i have rules added. I would like add one more rule in ...
5
votes
4
answers
15k
views
PowerShell find firewall rule by port
What I want to do
I want to list all firewall rules involving some ports and list their display name but the only way I found for now displays only the port part and has no idea what the display name ...
0
votes
0
answers
2k
views
Why does Test-NetConnection indicate connection can be made, but I cannot visit the site?
I need to determine whether a particular site is accessible on a particular port, given that firewall restrictions exist on the network.
If I cannot access the site on a particular port, then that ...
0
votes
1
answer
7k
views
Is there a way to find which firewall-profile is active?
I had a problem with servers connecting to the wrong firewall-profile so I am trying to find a solution to track this information.
I have already got the powershell commands in my python script:
...
1
vote
0
answers
538
views
PowerShell script for windows firewall to automatically set multiple remoteaddress networks?
Basically what I'm trying to do is block all incoming traffic from the internet. Incoming packets from the company's public subnets is okay. Users are able to VPN into the company so there is no use ...
1
vote
1
answer
264
views
How to group by all properties in PowerShell?
I'm planning to remove duplicate firewall rules on Windows. I know there are a set of firewall cmdlets like get-netfirewallrule, but it's too slow when I try to pass a firewall rule to get additional ...
2
votes
1
answer
1k
views
Adding multiple firewall rules in powershell without creating duplicate entries
I am trying to create multiple firewall rules, but I don't want to create a duplicate rule if it already exists.
Currently, my script will create the first rule, but then as it goes through the loop, ...
0
votes
1
answer
1k
views
windows bock firewall powershell script not working
I use testing firewall using ps cmds; after they run successfully; but when I open browser, I am still open to visit websites; do I miss anything and how to debug this? or is it because other exiting ...
1
vote
1
answer
1k
views
Is there a powershell command to add ipRules to CosmosDB in azure?
I'm trying to add an ip to the network rules of CosmosDb (firewall) in azure, using powershell.
A lot of other resources seem to have a command available to do this (eg. keyvault Add-...
0
votes
0
answers
243
views
Find correct internet protocol for given IP and PORT
I'm adding firewall rules for specific IP and PORT in Windows 10. But I'm getting errors the:
The protocol is invalid.
Address that I need to add:
13.79.172.43/8883,443
3.250.210.0/23
3.250.243.64/26
...
0
votes
1
answer
530
views
Firewall rule through group policy not detected
I created a firewall rule to block inbound port 138 using the local group policy editor (image 1 and image 2). When I run the Get-NetFirewallRule -DisplayName "" powershell command, I am ...
1
vote
1
answer
414
views
Passing multiple values to PowerShell script from text file
I'm quite new to PowerShell, so please don't blame me, I'm in complete darkness...
I have a text file containing hundreds of IP ranges.
What I want to achieve is to create a firewall rule which should ...
2
votes
1
answer
1k
views
Unable to add firewall rule to local GPO using new-getfirewallrule
I'm trying to add firewall rule using New-NetFirewallRule cmdlet. By default the rule is added to local FW. As per this https://learn.microsoft.com/en-us/powershell/module/netsecurity/new-...
0
votes
1
answer
417
views
Powershell extract TCP port from log file to update Firewall rule
Every time our FlexLm server reboots, the licensing services reset their input TCP port. I want to extract the new TCP port from the log file to update the firewall rule. I can extract the port number,...
2
votes
1
answer
621
views
which command that lists all the firewall rules on a system with the output containing the information and headers : Rule name, TCP port, Enabled? [closed]
I have been trying to get only specific data from the firewall rules in powershell. The command i tried is Get-NetFirewallRule | select DisplayName, Enabled, but it does not output required one.
0
votes
1
answer
614
views
Fetch whether Windows Firewall group contains all the enable rules or not
I wanted to fetch the boolean value whether the Windows Firewall group contains all the enabled rule or disabled rule. I am trying fetching the details through this command
Get-NetFirewallRule -...
0
votes
1
answer
1k
views
Disabling Datacenter Network Access to Cosmos DB Using Powershell / Azure CLI
I went through the documentation to find a way to disable the option "Accept connections from within public Azure datacenters" on the "Firewall and Virtual networks" settings page using Powershell, or ...
0
votes
0
answers
215
views
Firewall Rule with Powershell through Python
So I am trying to make a script that blocks a specific IP on my firewall.
I found that the Powershell command is:
New-NetFirewallRule -DisplayName "Name of Scope" -Direction Outbound –LocalPort Any -...
5
votes
1
answer
9k
views
What does the LinkedAuthorizationFailed mean in PowerShell?
I'm trying to add virtual network rules in a cosmos db using PowerShell. The VNETS exist in different tenants. I done the same for Storage accounts and it worked fine. I am getting the following error....
4
votes
1
answer
3k
views
Create a firewall rule using powershell
I am trying to create a firewall rule for java in powershell. The problem is that even if I create exactly the same rule as windows creates automatically, it simply ignores it (I create the rule, then ...
1
vote
0
answers
78
views
ASP.Net Webforms, run Powershell script on more than 200 Windows 10 machines where firewall is enabled
I need to Change Service user, Start and Stop Windows Services through PowerShell. I am invoking the PowerShell script from an ASP.Net Webforms.
All 200 Windows 10 machines are firewall enabled. I am ...
0
votes
1
answer
30
views
How can I Save Result to distinct variable
This is my code & Result :
PS C:\Windows\system32> $AllowedDisplayName = "CSLite_FireWall_Rule_Name"
$ruleallowedname = ( Get-NetFirewallRule -DisplayName "$AllowedDisplayName" )
$...
0
votes
1
answer
1k
views
turn off firewall with powershell command
I'm working on a command in Powershell that will look at the firewall (Domain) name (Enabled) and depending on if it's True the command will set it to false switching it off locally for the ...
9
votes
6
answers
7k
views
How to enable "Allow Azure services and resources to access this server" through PowerShell (Azure CLI)?
After creating a new Azure SQL server using az sql server create, how can I enable the following options through PowerShell(Azure CLI)?
1
vote
2
answers
2k
views
Windows Firewall Rule manipulation using PowerShell 2
I have the PowerShell code to manipulate Windows firewall rules so long as the installed PowerShell version is 4+. But I need to run these commands on windows servers with PowerShell 2. Everything I'...
1
vote
2
answers
1k
views
Change Windows Firewall Settings With PowerShell But Do Not Show Output
I have a PowerShell script I am using to install SQL Express, then SQL Server Management Studio, and finally, to edit the Windows Firewall settings to allow remote connections to the database. For ...
-1
votes
1
answer
372
views
Find Firewall in use via Powershell
How can I use Powershell to find the name of the firewall that is enabled on a machine?
I don't want to know if the firewall is enabled or not, I just want to know the name of it, i.e. what you see ...
0
votes
4
answers
2k
views
How can I speed up powershell to get firewall rules on windows 10?
I need to enumerate all firewall rules on windows 10 using PowerShell. I switched to PowerShell from netsh because some built-in rules were getting funny names like @{microsoft.windows....
1
vote
1
answer
2k
views
Extracting Data from CSV Files Using PowerShell
I've got a syslog server dumping logs from our firewall appliance to CSV files. I'm taking that csv file, and want to pull out certain pieces of data like source and destination IP addresses in the ...
2
votes
1
answer
971
views
Set Client IP address to the azure sql server automatically using vso powershell task
Issue : When i create the new sql server and DB. My next task is to connect with DB but it breaks due Client IP not added in the firewall of sql server.
I don't want to add it manually.
Is there any ...
2
votes
0
answers
429
views
implication of using ufw for azure cloud Ubuntu VM, port opened is not working as expected
I have a cloud Ubuntu VM which is in some resource group of company's subscription.
I do not have access to azure portal.
I had opened up the ports whichever relevant in azure portal while choosing ...
0
votes
0
answers
454
views
Older Powershell version command like Get-NetFirewallRules
I want to know if there is a cmdlet like Get-NetFirewallRules because i need to get my firewall rules, but in my server it run a older version of powershell.
I need to get info like local port, local ...