add Ip addresses via shell command
Hello, I would have 3 IPs to allow on the edges. Usually I add them through the console managment. 1) I wanted to know whether I could allow 3 (or more ) IPs through a shell command ?? 2) Also, could do the same but this time blocking some IPs?? Thanks to all in advance.
December 10th, 2009 11:30am

Take a look at the below MS Articles.. These are cmdlets which you use to allow or block IP addresses. Add-IPAllowListEntry and Add-IPblockListEntry Hope these help. Thanks.Vishal Ramnani | MCITP - Exchange 2007 | MCSE Messaging | MCTS - Win 2008 Config
Free Windows Admin Tool Kit Click here and download it now
December 10th, 2009 11:51am

If I have more than 1 IP, I assume I should do as follow: Add-IPAllowListEntry -IPAddress 192.168.0.100, 192.168.0.101, 192.168.0.103 Am I correct?
December 10th, 2009 11:58am

No. It will accept only a single IP address. It will not even accept pipe line input. Try below. "192.168.0.100", "192.168.0.101", "192.168.0.103" | foreach {Add-IPAllowListEntry -IPAddress $_} OR put the IP addresses in a Text file one in each line and try below. Get-content c:\IPaddresses.txt | foreach {Add-IPAllowListEntry -IPaddress $_} Hope this helps. Thanks. Vishal Ramnani | MCITP - Exchange 2007 | MCSE Messaging | MCTS - Win 2008 Config
Free Windows Admin Tool Kit Click here and download it now
December 10th, 2009 12:59pm

Just a quick question Vishal, would that leave all my IPs already blocked/existed?? Again thank u very much for ur help!! Appreciated
December 11th, 2009 10:54am

Yes! as the cmdlet says, it will just add new IP addresses. Thanks.Vishal Ramnani | MCITP - Exchange 2007 | MCSE Messaging | MCTS - Win 2008 Config
Free Windows Admin Tool Kit Click here and download it now
December 11th, 2009 11:18am

I did: Add-IPAllowListEntry -IPAddress "192.168.0.100", "192.168.0.101", "192.168.0.103" | foreach {Add-IPAllowListEntry -IPA ddress $_} But I got the below error message Add-IPAllowListEntry : Cannot convert 'System.Object[]' to the type 'System.Net.IPAddress' required by parameter 'IPAddress'. Specified method is not supported. At line:1 char:32 + Add-IPAllowListEntry -IPAddress <<<< "192.168.0.100", "192.168.0.101", "192.168.0.103" | foreach {Add-IPAllowListEntry -IPAddress $_}
December 11th, 2009 2:08pm

As I said, -IPAddress parameter does not accept multiple value. You should Pipe through an array of IP and then use Foreach-Object cmdlet. "192.168.0.100", "192.168.0.101", "192.168.0.103" | foreach {Add-IPAllowListEntry -IPAddress $_} Thanks. Vishal Ramnani MCITP - Exchange 2007, MCSE Messaging, MCTS - Win 2008 Config
Free Windows Admin Tool Kit Click here and download it now
December 11th, 2009 2:52pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics