Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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" 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.

share|improve this question
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 posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.