Grant-SCIPAddress

Allocates a static or virtual IP address from a specified address pool.

Syntax

Grant-SCIPAddress [-Description <String>] [-DisableReconcile <Boolean>] [-ExplicitRevokeRequired <Boolean>]
 [-GrantToObjectID <Guid>] -GrantToObjectType <AllocatedToObjectType> [-IPAddress <String>]
 [-JobVariable <String>] [-OnBehalfOfUser <String>] [-OnBehalfOfUserRole <UserRole>] [-PROTipID <Guid>]
 [-RunAsynchronously] -StaticIPAddressPool <StaticIPAddressPool> [-VMMServer <ServerConnection>]
 [<CommonParameters>]
Grant-SCIPAddress [-Description <String>] [-DisableReconcile <Boolean>] [-ExplicitRevokeRequired <Boolean>]
 -IPAddress <String> [-JobVariable <String>] [-NetworkController <VirtualSwitchExtensionManager>]
 [-OnBehalfOfUser <String>] [-OnBehalfOfUserRole <UserRole>] [-Owner <String>] [-PROTipID <Guid>]
 [-PublicIPAddress] [-RunAsynchronously] [-UserRole <UserRole>] [-VMMServer <ServerConnection>]
 [<CommonParameters>]

Description

The Grant-SCIPAddress cmdlet allocates static IP and virtual IP addresses from a specified address pool.

To grant a specific IP address, use the IPAddress parameter. Otherwise, Virtual Machine Manager (VMM) chooses the IP address from the address pool.

Examples

Example 1: Allocate an IP address

PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> $vNICs = $VM.VirtualNetworkAdapters
PS C:\> $IPPool = Get-SCStaticIPAddressPool -Name "Production IP Address Pool"
PS C:\> Grant-SCIPAddress -StaticIPAddressPool $IPPool -GrantToObjectType VirtualNetworkAdapter -GrantToObjectID $vNICs[0].ID -Description $VM.Name

The first command gets the virtual machine object named VM01 and stores the object in the $VM variable.

The second command gets the virtual network adapter objects for virtual machine VM01 and stores the objects in the $vNICs variable.

The third command gets the static IP address pool object named Production IP Address Pool and stores the object in the $IPPool variable.

The last command allocates an IP address from the static IP address pool stored in $IPPool to the first virtual network adapter stored in $vNICs, and supplies VM01 as the description for the allocated IP address.

Parameters

-Description

Specifies a description for the object.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DisableReconcile
Type:Boolean
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ExplicitRevokeRequired
Type:Boolean
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-GrantToObjectID

Specifies the ID of an object to which an allocated IP address or MAC address is assigned.

Type:Guid
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-GrantToObjectType

Specifies a value for AllocatedToObjectType to which an allocated IP address or virtual IP address is assigned. The acceptable values for this parameter are:

- VirtualNetworkAdapter

  • VIP
  • HostNetworkAdapter
  • LoadBalancerConfiguration
  • VirtualMachine
  • HostCluster

Type:AllocatedToObjectType
Parameter Sets:VirtualNetworkAdapter, VIP, HostNetworkAdapter, LoadBalancerConfiguration, VirtualMachine, HostCluster, VMSubnet, NetworkService, NATConnection, NetworkGateway, StorageArray, VMNetworkGateway, None
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IPAddress

Specifies an IPv4 or IPv6 address.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-JobVariable

Specifies that job progress is tracked and stored in the variable named by this parameter.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-NetworkController

Specifies a network controller.

Type:VirtualSwitchExtensionManager
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-OnBehalfOfUser

Specifies a user name. This cmdlet operates on behalf of the user that this parameter specifies.

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-OnBehalfOfUserRole

Specifies a user role. To obtain a user role, use the Get-SCUserRole cmdlet. This cmdlet operates on behalf of the user role that this parameter specifies.

Type:UserRole
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Owner

Specifies the owner of a VMM object in the form of a valid domain user account.

- Example format: -Owner "Contoso\PattiFuller"

  • Example format: -Owner "PattiFuller@Contoso"

Type:String
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Type:Guid
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PublicIPAddress
Type:SwitchParameter
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StaticIPAddressPool

Specifies an IP address pool from which you can assign static IP addresses.

Type:StaticIPAddressPool
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-UserRole
Type:UserRole
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VMMServer

Specifies a VMM server object.

Type:ServerConnection
Required:False
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Outputs

CloudDRPairingInfoData

This cmdlet returns a **CloudDRPairingInfoData** object.

Notes

* This cmdlet requires a VMM static IP address pool object, which can be retrieved using the **Get-SCStaticIPAddressPool** cmdlet.