add-IPAllowList from text file
Hello I am using exchange 2007, I am trying to add a large number of IP addresses using this command which I got on this forum Get-content c:\allowedIPs.txt | foreach {Add-IPAllowListEntry -IPaddress $_} where the IPs are listed in the text file. However I receve these errors for each of the individual IP's- Add-IPAllowListEntry : Cannot bind parameter 'IPAddress'. Cannot convert value " 62.187.235.32/27" to type "System.Net.IPAddress". Error: "An invalid IP address was specified." At line:1 char:68 + Get-content c:\allow.txt | foreach {Add-IPAllowListEntry -IPaddress <<<< $_} + CategoryInfo : InvalidArgument: (:) [Add-IPAllowListEntry], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Exchange.Management.SystemCon figurationTasks.AddIPAllowListEntry I'm new to this so any help appreciated thanks
February 18th, 2010 2:39pm

Hi, Why are you giving such value in IP Address "62.187.235.32/27". I think it shud be without the forward slash like this 62.187.235.32 or 62.187.235.27. Also for putting an IP range use parameter "-IPRange" instead of -IPAddress. Regards, Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2010 3:42pm

Hi there,I don't believe /27 is supported.Try a new text file with just the one IP and subnet in this format and ensure it works OK."62.187.235.32(255.255.255.224)"If you are migrating your settings from Exchange 2003 (ignore me if you're not), you can make your life easier by using the Exchange 2007 Anti Spam Migration Tool, check here for more information: http://www.msexchange.org/articles_tutorials/exchange-server-2007/security-message-hygiene/anti-spam-migration-tool.htmlOliverOliver Moazzezi | Exchange MVP, MCSA:M, MCTS:Exchange 2010, BA (Hons) Anim | http://www.exchange2007.com | http://www.exchange2010.com | http://www.cobweb.com |
February 18th, 2010 3:44pm

thanks for your replies-I am using the IP range to block IP addresses from specific countries, I tried the -IPRange parameter but I see that it is not allowed as the error is Add-IPAllowListEntry : Cannot bind parameter 'IPRange'. Cannot convert value " 193.120.225.192/26" to type "Microsoft.Exchange.Data.IPRange". Error: "The format of the IP address 193.120.225.192 is invalid. Example of a valid IP address: 192.168.1.10"
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2010 4:55pm

Thanks-I tried that but unfortunately I still receive an errror Add-IPAllowListEntry : Cannot bind parameter 'IPAddress'. Cannot convert value ""62.187.235.32(255.25 5.255.224)"" to type "System.Net.IPAddress". Error: "An invalid IP address was specified." At line:1 char:69
February 18th, 2010 4:58pm

Try it without the subnet.Oliver Moazzezi | Exchange MVP, MCSA:M, MCTS:Exchange 2010, BA (Hons) Anim | http://www.exchange2007.com | http://www.exchange2010.com | http://www.cobweb.com |
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2010 5:06pm

Hi, I have successfully run this command on my Ex2007 SP2 server. Add-IPAllowListEntry -IPRange:192.168.0.1/26 Regards,Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
February 18th, 2010 5:07pm

Thanks for the replies- Add-IPAllowListEntry -IPRange:192.168.0.1/26 will work, but I have a text file of several hundred ranges with subnets, so can I import these in one go rather than individually typing them?
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2010 5:10pm

Hi, Yes you can do that using text file. Your method, posted in original post will work with -IPRange parameter. I have just tested it. I have created a text file "AllowedIPs.txt" and put 192.168.0.1/29 192.168.0.1/30 and then ran this command Get-content c:\allowedIPs.txt | foreach {Add-IPAllowListEntry -IPRange $_} it worked successfully. You can also give -IPRange like this 192.168.0.1-192.168.0.100 Regards, Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
February 18th, 2010 5:15pm

Thanks-I tried that but unfortunately I still receive an errror Add-IPAllowListEntry : Cannot bind parameter 'IPAddress'. Cannot convert value ""62.187.235.32(255.255.255.224)"" to type "System.Net.IPAddress". Error: "An invalid IP address was specified."At line:1 char:69 Right. This is getting confusing as it is stating IP addresses one minute then IP ranges the other :-)So you are trying to add ranges and not single IP addresses. In that case the above error is trying to import your text file with the specified ranges as just IP addresses.Your script is asking for IP Address input, hence the error. Look:Get-content c:\allowedIPs.txt | foreach {Add-IPAllowListEntry -IPaddress $_}You need to update it to:Get-content c:\allowedIPs.txt | foreach {Add-IPAllowListEntry -IPRange $_}Try that. OliverOliver Moazzezi | Exchange MVP, MCSA:M, MCTS:Exchange 2010, BA (Hons) Anim | http://www.exchange2007.com | http://www.exchange2010.com | http://www.cobweb.com |
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2010 5:17pm

That's worked a treat-thanks for your help-it seemed that my formatting in the text file was causing problems Much appreciated!
February 18th, 2010 5:25pm

That's worked a treat-thanks for your help-it seemed that my formatting in the text file was causing problemsMuch appreciated! Glad it's working for you.Take care,OliverOliver Moazzezi | Exchange MVP, MCSA:M, MCTS:Exchange 2010, BA (Hons) Anim | http://www.exchange2007.com | http://www.exchange2010.com | http://www.cobweb.com |
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2010 5:35pm

On Thu, 18 Feb 2010 13:55:25 +0000, fpittion wrote:>thanks for your replies-I am using the IP range to block IP addresses from specific countries, Why not try a country-specific DNSBL? It's sure be a lot easier todeal with. Or create your own DNS zones and put them on your DNS, thenuse 'em as your own DNSBL.http://spamlinks.net/filter-bl.htm#ip-country---Rich MatheisenMCSE+I, Exchange MVP--- Rich Matheisen MCSE+I, Exchange MVP
February 20th, 2010 7:56am

On Thu, 18 Feb 2010 11:39:22 +0000, fpittion wrote:>Hello I am using exchange 2007, I am trying to add a large number of IP addresses using this command which I got on this forum Get-content c:\allowedIPs.txt | foreach {Add-IPAllowListEntry -IPaddress $_} where the IPs are listed in the text file. However I receve these errors for each of the individual IP's- Add-IPAllowListEntry : Cannot bind parameter 'IPAddress'. Cannot convert value " 62.187.235.32/27"Well, the error is real. You're using the parameter -IPAddress whenyou really want to use -IPRange.---Rich MatheisenMCSE+I, Exchange MVP--- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
February 20th, 2010 7:57am

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

Other recent topics Other recent topics