Any ideas how should I proceed if I would like to update the firewall rules (essentially add ip-s to existing firewall rule).

The step of exporting ip-s to text file and then using command line to add/edit rules seems like a extra step that requires some sort of automation as well.

Basically a ban list - it would currently only ban the account itself but I would like to use the associated ip to add it to the firewall rule whenever a new ban is added (trigger to check the update is a way to go) - but I'm not sure how to incorporate firewall update with SQL Server.

Would a trigger allow to run a command line command line function lets say basic "ping google.com" to start and test if it works.


SELECT i.ip FROM inserted AS i
INNER JOIN deleted AS d
ON i.ip = d.ip
"now do the  command line tricks and pass the i.ip as a parameter like " ping i.ip

So how should i proceed about the command line part?

SQL Server 2008 R2 sp2 windows 2008 server.

  • 1
    Sounds like a case for Powershell to affect the OS change. xp_cmdshell might get it done but I can't recall firewall command line controls myself. Lots of PS wizards here to help out though. – Eric Higgins Aug 24 '12 at 21:38
  • yeh the firewall cmd line part isnt a problem, im just wondering how do i get access to them, powershell would work too i guess. xp_cmdshell - but can i pass a value to it from SELECT ? – Agony Aug 24 '12 at 22:41
  • Are you trying to add/modify firewall rules on the SQL server itself, or on a remote server? – Jon Seigel Aug 25 '12 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.