Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to add a large block of IP addresses to our NIC in Server 2008 R2. For some reason this isn't working from the command line or from a batch file though.

FOR /L %A IN (131,1,190) DO netsh interface ipv4 add address "Local Area Connection" 206.217.129.%A 255.255.255.192

I am getting the message "A wasn't expected at this time" although from looking at it the syntax appears to be correct.

share|improve this question
    
Just to note though, issuing it without the loop stuff works fine. –  Brett Powell Jun 3 '11 at 21:37
add comment

1 Answer

up vote 2 down vote accepted

If you're running it from cmd, %A is fine, if you're running it from a batch, it should be %%A.

share|improve this answer
    
Ah that makes sense, thank you. Is there a reason they don't show up in the IPv4 settings? –  Brett Powell Jun 3 '11 at 21:43
    
@Brett - They should, where are you looking? I don't really have any experience adding 60 IPs to a single interface, that's a pretty unusual situation, so I'm not sure how Windows dialogues handle that. –  MDMarra Jun 3 '11 at 21:46
    
Yeah, I have no idea why we had such a large block assigned to the machine. We generally just add /29 and /28 blocks as needed. Anyways, thanks for the help! –  Brett Powell Jun 3 '11 at 21:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.