Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 746
  • Last Modified:

Would like to get unassigned IP address from static address pool with powershell

Using VMM and Hyper-V on 2012 R2.
I would like to get an available IP address from an static IP address pool and assign it to a nic on a vm:
$address = Get-SCIPAddress -UnAssigned -StaticIPAddressPool (Get-SCStaticIPAddressPool -Name "AddressPool")
$Adapter = (Get-SCVirtualNetworkAdapter -VM (get-vm -name "vmName")  | where  {$_.VLanID -eq "123"})
Set-SCVirtualNetworkAdapter -IPv4AddressType Static -VirtualNetworkAdapter $Adapter -IPv4Addresses $address[0].Address

Open in new window


However the first line returns no address. If I use the option -Assigned, I will get a list of addresses already used, but I would like the -UnAssigned switch to work. I guess I could figure out what is unassigned if i know what is assigned, but that would be a workaround.
0
itnifl
Asked:
itnifl
  • 3
1 Solution
 
Dimarc67Commented:
Are you returning IP addresses to the unassigned pool?  Any chance that the unassigned pool is empty?
0
 
itniflAuthor Commented:
What is an unassigned pool? I want to get unassigned IP addresses from a static IP address pool in VMM.
0
 
itniflAuthor Commented:
Seems that there is no way to get unassigned IP addresses with this cmdlet. The -unassigned switch retrieves allocated addresses that have not been assigned to a resource: http://technet.microsoft.com/library/jj654453(v=sc.20).aspx
"Retrieves IP addresses or MAC addresses that have been allocated from an address pool but not assigned to a resource."
0
 
itniflAuthor Commented:
Seems like that was the best possible answer
0

Featured Post

Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now