powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Apply-VMHostProfile



NAME
Apply-VMHostProfile

SYNOPSIS
Applies a host profile to the specified host or cluster.

SYNTAX
Apply-VMHostProfile [-Entity] [-Profile ] [-Variable ] [-AssociateOnly]
[-ApplyOnly] [-RunAsync] [-Server ] [-WhatIf] [-Confirm] []


DESCRIPTION
Applies a host profile to the specified host or cluster. The host or cluster must be in a maintenance mode. If no v
alue is provided to the -Profile parameter, the profile currently associated with the host or cluster is applied.


PARAMETERS
-Entity
Specify hosts or clusters to which you want to apply the virtual machine host profile.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-Profile
Specify the host profile you want to apply.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-Variable
Specify a hash table object that provides values for the host profile required variables.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

-AssociateOnly
Indicate whether to associate the host profile to the specified host or cluster without applying it.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-ApplyOnly
Indicate whether to apply the host profile to the specified virtual machine host without associating it.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-RunAsync
Indicate that the command returns immediately without waiting for the task to complete. In this mode, the outpu
t of the cmdlet is a Task object. For more information about the -RunAsync parameter run " help About_RunAsync"
in the vSphere PowerCLI console.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Server
Specify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the co
mmand runs on the default servers. For more information about default servers, see the description of Connect-V
IServer.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? true

-WhatIf
Indicate that the cmdlet is run only to display the changes that would be made and actually no objects are modi
fied.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Confirm
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


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
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 a
nd the current or default values is returned. Otherwise, all directly affected host and cluster objects are ret
urned. If the cmdlet is run for a cluster with the -AssociateOnly parameter set, only the cluster object is ret
urned, but not its hosts.

-------------- Example 1 --------------

C:\PS>Apply-VMHostProfile -AssociateOnly -Entity $cluster -Profile $profile


Associates the specified profile to all hosts in the specified cluster.





-------------- Example 2 --------------

C:\PS>Apply-VMHostProfile -Entity $host -Profile $profile


Associates and applies the specified profile to the specified host.





-------------- Example 3 --------------

C:\PS>Get-VMHost | Apply-VMHostProfile -ApplyOnly -Profile $profile


Applies the specified profile to all specified hosts.





-------------- Example 4 --------------

C:\PS>Get-VMHost | Apply-VMHostProfile -AssociateOnly -profile $profile


Asscociates the specified profile to all specified hosts.





-------------- Example 5 --------------

C:\PS>Apply-VMHostProfile $host


Applies the associated host's profile to the host.





-------------- Example 6 --------------

C:\PS>$requireInput = Apply-VMHostProfile $host -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';

Apply-VMHostProfile $host -Profile $profile -Variable $requireInput;


Applies a profile to host but first assigns values to all required values.






RELATED LINKS
Online version: http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Apply-VMHostProfile.html
Export-VMHostProfile
Get-VMHostProfile
Import-VMHostProfile
New-VMHostProfile
Remove-VMHostProfile
Set-VMHostProfile
Test-VMHostProfileCompliance