用命令来操作vSphere:十四 PowerCLI命令--主机配置文件
2011-06-18 23:00
513 查看
1.Get-VMHostProfile
功能:获取可用的主机配置文件。
语法:
Get-VMHostProfile [[-Name] <String[]>] [-Description <String[]>] [-Entity <InventoryItem[]>] [-ReferenceHost <VMHost[]>] [-Server <VIServer[]>] [<CommonParameters>]
例子:
Get-VMHostProfile -Name Profile
2.Set-VMHostProfile
功能:修改指定的主机配置文件。
语法:
Set-VMHostProfile [[-Name] <String>] [[-ReferenceHost] <VMHost>] [-Profile] <VMHostProfile> [-Description <String>] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
$profile = ( Get-VMHostProfile -Name Profile )[0] Set-VMHostProfile -Profile $profile -Description "New description."
3.New-VMHostProfile
功能:创建一个基于主机参考的新的主机配置文件。
语法:
New-VMHostProfile [-Name] <String> [-ReferenceHost] <VMHost> [-Description <String>] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
$h = Get-VMHost 10.23.134.133
New-VMHostProfile -Name testProfile -Description "This is my first test profile." -ReferenceHost $h
4.Apply-VMHostProfile
功能:应用主机配置文件到指定的主机或群集。
语法:
Apply-VMHostProfile [-Entity] <InventoryItem> [-Profile <VMHostProfile>] [-Variable <Hashtable>] [-AssociateOnly] [-ApplyOnly] [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
(1)
$profile = Get-VMHostProfile -Name Profile Apply-VMHostProfile -Entity Host -Profile $profile -Confirm:$false
(2)
$profile = Get-VMHostProfile -Name Profile Apply-VMHostProfile -AssociateOnly -Entity Cluster -Profile $profile -Confirm:$false
(3)
$profile = Get-VMHostProfile -Name Profile Apply-VMHostProfile -AssociateOnly -Profile $profile -Entity (Get-Cluster)
(4)
$profile = Get-VMHostProfile -Name Profile $additionalConfiguration = Apply-VMHostProfile -ApplyOnly -Profile $profile -Entity 10.23.114.166 $additionalConfiguration['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy.address'] = '10.0.0.128' $additionalConfiguration['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy.subnetmask = '255.255.255.0' Apply-VMHostProfile -ApplyOnly -Profile $profile -Entity 10.23.114.166 -Variable $additionalConfiguration
(5)
Apply-VMHostProfile -Profile $profile -Entity 10.23.114.166
5.Remove-VMHostProfile
功能:删除指定的主机配置文件。
语法:
Remove-VMHostProfile [-Profile] <VMHostProfile[]> [[-Server] <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-VMHostProfile -Entity <InventoryItem[]> [[-Server] <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
Get-VMHostProfile -Name Profile | Remove-VMHostProfile -Confirm:$false
6.Import-VMHostProfile
功能:从一个文件中导入主机配置文件。文件路径必须从vSphere PowerCLI客户端访问。
语法:
Import-VMHostProfile [-FilePath] <String> [-Name] <String> [[-ReferenceHost] <VMHost>] [-Description <String>] [-Server <VIServer>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
Import-VMHostProfile -FilePath export.prf -Name Profile
7.Export-VMHostProfile
功能:导出指定的主机配置文件到一个文件。
语法:
Export-VMHostProfile [-FilePath] <String> [-Profile] <VMHostProfile> [-Force] [-Server <VIServer>] [<CommonParameters>]
例子:
$profile = (Get-VMHostProfile -Name Profile )[0] Export-VMHostProfile -FilePath export.prf -Profile $profile –Force
8.Test-VMHostProfileCompliance
功能:测试主机配置文件的兼容性。
语法:
Test-VMHostProfileCompliance [-VMHost] <VMHost[]> [-UseCache] [[-Server] <VIServer[]>] [<CommonParameters>]
Test-VMHostProfileCompliance [-Profile] <VMHostProfile[]> [-UseCache] [[-Server] <VIServer[]>] [<CommonParameters>]
例子:
(1)
Test-VMHostProfileCompliance -VMHost Host
(2)
$profile = Get-VMHostProfile -Name Profile Apply-VMHostProfile -AssociateOnly -Profile $profile -Entity 10.0.0.126 Test-VMHostProfileCompliance -VMHost 10.0.0.126 | fl *
(3)
Test-VMHostProfileCompliance -Profile $profile | fl *
功能:获取可用的主机配置文件。
语法:
Get-VMHostProfile [[-Name] <String[]>] [-Description <String[]>] [-Entity <InventoryItem[]>] [-ReferenceHost <VMHost[]>] [-Server <VIServer[]>] [<CommonParameters>]
例子:
Get-VMHostProfile -Name Profile
2.Set-VMHostProfile
功能:修改指定的主机配置文件。
语法:
Set-VMHostProfile [[-Name] <String>] [[-ReferenceHost] <VMHost>] [-Profile] <VMHostProfile> [-Description <String>] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
$profile = ( Get-VMHostProfile -Name Profile )[0] Set-VMHostProfile -Profile $profile -Description "New description."
3.New-VMHostProfile
功能:创建一个基于主机参考的新的主机配置文件。
语法:
New-VMHostProfile [-Name] <String> [-ReferenceHost] <VMHost> [-Description <String>] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
$h = Get-VMHost 10.23.134.133
New-VMHostProfile -Name testProfile -Description "This is my first test profile." -ReferenceHost $h
4.Apply-VMHostProfile
功能:应用主机配置文件到指定的主机或群集。
语法:
Apply-VMHostProfile [-Entity] <InventoryItem> [-Profile <VMHostProfile>] [-Variable <Hashtable>] [-AssociateOnly] [-ApplyOnly] [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
(1)
$profile = Get-VMHostProfile -Name Profile Apply-VMHostProfile -Entity Host -Profile $profile -Confirm:$false
(2)
$profile = Get-VMHostProfile -Name Profile Apply-VMHostProfile -AssociateOnly -Entity Cluster -Profile $profile -Confirm:$false
(3)
$profile = Get-VMHostProfile -Name Profile Apply-VMHostProfile -AssociateOnly -Profile $profile -Entity (Get-Cluster)
(4)
$profile = Get-VMHostProfile -Name Profile $additionalConfiguration = Apply-VMHostProfile -ApplyOnly -Profile $profile -Entity 10.23.114.166 $additionalConfiguration['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy.address'] = '10.0.0.128' $additionalConfiguration['network.hostPortGroup["key-vim-profile-host-HostPortgroupProfile-VMkernel"].ipConfig.IpAddressPolicy.subnetmask = '255.255.255.0' Apply-VMHostProfile -ApplyOnly -Profile $profile -Entity 10.23.114.166 -Variable $additionalConfiguration
(5)
Apply-VMHostProfile -Profile $profile -Entity 10.23.114.166
5.Remove-VMHostProfile
功能:删除指定的主机配置文件。
语法:
Remove-VMHostProfile [-Profile] <VMHostProfile[]> [[-Server] <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-VMHostProfile -Entity <InventoryItem[]> [[-Server] <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
Get-VMHostProfile -Name Profile | Remove-VMHostProfile -Confirm:$false
6.Import-VMHostProfile
功能:从一个文件中导入主机配置文件。文件路径必须从vSphere PowerCLI客户端访问。
语法:
Import-VMHostProfile [-FilePath] <String> [-Name] <String> [[-ReferenceHost] <VMHost>] [-Description <String>] [-Server <VIServer>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
Import-VMHostProfile -FilePath export.prf -Name Profile
7.Export-VMHostProfile
功能:导出指定的主机配置文件到一个文件。
语法:
Export-VMHostProfile [-FilePath] <String> [-Profile] <VMHostProfile> [-Force] [-Server <VIServer>] [<CommonParameters>]
例子:
$profile = (Get-VMHostProfile -Name Profile )[0] Export-VMHostProfile -FilePath export.prf -Profile $profile –Force
8.Test-VMHostProfileCompliance
功能:测试主机配置文件的兼容性。
语法:
Test-VMHostProfileCompliance [-VMHost] <VMHost[]> [-UseCache] [[-Server] <VIServer[]>] [<CommonParameters>]
Test-VMHostProfileCompliance [-Profile] <VMHostProfile[]> [-UseCache] [[-Server] <VIServer[]>] [<CommonParameters>]
例子:
(1)
Test-VMHostProfileCompliance -VMHost Host
(2)
$profile = Get-VMHostProfile -Name Profile Apply-VMHostProfile -AssociateOnly -Profile $profile -Entity 10.0.0.126 Test-VMHostProfileCompliance -VMHost 10.0.0.126 | fl *
(3)
Test-VMHostProfileCompliance -Profile $profile | fl *
相关文章推荐
- 用命令来操作vSphere:二十四 PowerCLI命令--日志/报告/配置
- 用命令来操作vSphere:七操作ESX配置文件的基础-Linux下文本编辑器vi
- 用命令来操作vSphere:二十二 PowerCLI命令--虚拟主机操作(1)
- 用命令来操作vSphere:八在ESX下的主要配置文件
- 用命令来操作vSphere:二十三 PowerCLI命令--虚拟主机操作(2)
- redis配置文件参数说明及命令操作
- python写的批量操作远程主机脚本(命令执行,上传、下载文件)
- 用命令来操作vSphere:十二 PowerCLI命令--网络操作(1) 推荐
- python写的批量操作远程主机脚本(命令执行,上传、下载文件)
- 用命令来操作vSphere:十五 PowerCLI命令--客户机操作系统
- 用命令来操作vSphere:十七 PowerCLI命令--存储操作
- Ubuntu apache2重启命令与主机配置文件
- python写的批量操作远程主机脚本(命令执行,上传、下载文件)
- 用命令来操作vSphere:十八 PowerCLI命令--资源池操作
- 用命令来操作vSphere:二十一 PowerCLI命令--vShphere服务器(3)
- linux基本命令操作-目录与文件的配置和管理
- 用命令来操作vSphere:二十七 PowerCLI脚本—谁创建了虚拟机
- (十四)文件操作——stat命令与函数
- python写的批量操作远程主机脚本(命令执行,上传、下载文件)