< Back
Invoke-VMHostProfile
Post
NAME Invoke-VMHostProfile
SYNOPSIS
This cmdlet applies a host profile to the specified host or cluster.
SYNTAX
Invoke-VMHostProfile [-Entity] <InventoryItem[]> [-ApplyOnly] [-AssociateOnly] [-Profile <VMHostProfile>]
[-RunAsync] [-Server <VIServer[]>] [-Variable <Hashtable>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
This cmdlet applies a host profile to the specified host or cluster. The host or cluster must be in a maintenance
mode. If no value is provided to the Profile parameter, the profile currently associated with the host or cluster
is applied.
PARAMETERS
-ApplyOnly [<SwitchParameter>]
Indicates whether to apply the host profile to the specified virtual machine host without associating it.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-AssociateOnly [<SwitchParameter>]
Indicates whether to associate the host profile to the specified host or cluster without applying it.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Entity <InventoryItem[]>
Specifies hosts or clusters to which you want to apply the virtual machine host profile.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? true
-Profile <VMHostProfile>
Specifies the host profile you want to apply.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? true
-RunAsync [<SwitchParameter>]
Indicates that the command returns immediately without waiting for the task to complete. In this mode, the
output of the cmdlet is a Task object. For more information about the RunAsync parameter run "help
About_RunAsync" in the VMware PowerCLI console.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Server <VIServer[]>
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this
parameter, the command runs on the default servers. For more information about default servers, see the
description of Connect-VIServer.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? true
-Variable <Hashtable>
Specifies a hash table object that provides values for the host profile required variables.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false,
the cmdlet runs without asking for user confirmation.
Required? false
Position? named
Default value $true
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are
modified.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
Zero or more VMHost or Cluster or System.Collections.Hashtable
NOTES
If there are missing values for the required variables, a hash table with the names of the required variables
and the current or default values is returned. Otherwise, all directly affected host and cluster objects are
returned. If the cmdlet is run for a cluster with the AssociateOnly parameter set, only the cluster object is
returned, but not its hosts.
-------------------------- Example 1 --------------------------
Invoke-VMHostProfile -AssociateOnly -Entity $cluster -Profile $profile
Associates the specified profile to all hosts in the specified cluster.
-------------------------- Example 2 --------------------------
Invoke-VMHostProfile -Entity $vmhost -Profile $profile
Associates and applies the specified profile to the specified host.
-------------------------- Example 3 --------------------------
Get-VMHost | Invoke-VMHostProfile -ApplyOnly -Profile $profile
Applies the specified profile to all specified hosts.
-------------------------- Example 4 --------------------------
Get-VMHost | Invoke-VMHostProfile -AssociateOnly -profile $profile
Associates the specified profile to all specified hosts.
-------------------------- Example 5 --------------------------
Invoke-VMHostProfile $vmhost
Applies the associated host's profile to the host.
-------------------------- Example 6 --------------------------
$requireInput = Invoke-VMHostProfile $vmhost -Profile $profile;
$requireInput['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy
.address'] = '192.168.0.1';
$requireInput['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy
.subnetmask'] = '255.255.255.0';
Invoke-VMHostProfile $vmhost -Profile $profile -Variable $requireInput;
Applies a profile to host but first assigns values to all required values.
RELATED LINKS
Online Version: https://code.vmware.com/doc/preview?id= ... ofile.html
Export-VMHostProfile
Get-VMHostProfile
Import-VMHostProfile
New-VMHostProfile
Remove-VMHostProfile
Set-VMHostProfile
Test-VMHostProfileCompliance
SYNOPSIS
This cmdlet applies a host profile to the specified host or cluster.
SYNTAX
Invoke-VMHostProfile [-Entity] <InventoryItem[]> [-ApplyOnly] [-AssociateOnly] [-Profile <VMHostProfile>]
[-RunAsync] [-Server <VIServer[]>] [-Variable <Hashtable>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
This cmdlet applies a host profile to the specified host or cluster. The host or cluster must be in a maintenance
mode. If no value is provided to the Profile parameter, the profile currently associated with the host or cluster
is applied.
PARAMETERS
-ApplyOnly [<SwitchParameter>]
Indicates whether to apply the host profile to the specified virtual machine host without associating it.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-AssociateOnly [<SwitchParameter>]
Indicates whether to associate the host profile to the specified host or cluster without applying it.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Entity <InventoryItem[]>
Specifies hosts or clusters to which you want to apply the virtual machine host profile.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? true
-Profile <VMHostProfile>
Specifies the host profile you want to apply.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? true
-RunAsync [<SwitchParameter>]
Indicates that the command returns immediately without waiting for the task to complete. In this mode, the
output of the cmdlet is a Task object. For more information about the RunAsync parameter run "help
About_RunAsync" in the VMware PowerCLI console.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Server <VIServer[]>
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this
parameter, the command runs on the default servers. For more information about default servers, see the
description of Connect-VIServer.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? true
-Variable <Hashtable>
Specifies a hash table object that provides values for the host profile required variables.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false,
the cmdlet runs without asking for user confirmation.
Required? false
Position? named
Default value $true
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are
modified.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
Zero or more VMHost or Cluster or System.Collections.Hashtable
NOTES
If there are missing values for the required variables, a hash table with the names of the required variables
and the current or default values is returned. Otherwise, all directly affected host and cluster objects are
returned. If the cmdlet is run for a cluster with the AssociateOnly parameter set, only the cluster object is
returned, but not its hosts.
-------------------------- Example 1 --------------------------
Invoke-VMHostProfile -AssociateOnly -Entity $cluster -Profile $profile
Associates the specified profile to all hosts in the specified cluster.
-------------------------- Example 2 --------------------------
Invoke-VMHostProfile -Entity $vmhost -Profile $profile
Associates and applies the specified profile to the specified host.
-------------------------- Example 3 --------------------------
Get-VMHost | Invoke-VMHostProfile -ApplyOnly -Profile $profile
Applies the specified profile to all specified hosts.
-------------------------- Example 4 --------------------------
Get-VMHost | Invoke-VMHostProfile -AssociateOnly -profile $profile
Associates the specified profile to all specified hosts.
-------------------------- Example 5 --------------------------
Invoke-VMHostProfile $vmhost
Applies the associated host's profile to the host.
-------------------------- Example 6 --------------------------
$requireInput = Invoke-VMHostProfile $vmhost -Profile $profile;
$requireInput['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy
.address'] = '192.168.0.1';
$requireInput['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy
.subnetmask'] = '255.255.255.0';
Invoke-VMHostProfile $vmhost -Profile $profile -Variable $requireInput;
Applies a profile to host but first assigns values to all required values.
RELATED LINKS
Online Version: https://code.vmware.com/doc/preview?id= ... ofile.html
Export-VMHostProfile
Get-VMHostProfile
Import-VMHostProfile
New-VMHostProfile
Remove-VMHostProfile
Set-VMHostProfile
Test-VMHostProfileCompliance