Set-AzureVMCustomScriptExtension
设置 Azure 虚拟机自定义脚本扩展的信息。
注意
本文档中引用的 cmdlet 用于管理使用 Azure Service Manager (ASM) API 的旧式 Azure 资源。 创建新资源时,建议不要使用旧的 PowerShell 模块,因为计划将停用 ASM。 有关详细信息,请参阅 Azure Service Manager 停用。
Az PowerShell 模块是建议用于管理 PowerShell 的 Azure 资源管理器 (ARM) 资源的 PowerShell 模块。
语法
SetCustomScriptExtensionByContainerAndFileNames (默认值)
Set-AzureVMCustomScriptExtension
[[-ReferenceName] <String>]
[[-Version] <String>]
[-ContainerName] <String>
[-FileName] <String[]>
[[-StorageAccountName] <String>]
[[-StorageEndpointSuffix] <String>]
[[-StorageAccountKey] <String>]
[[-Run] <String>]
[[-Argument] <String>]
-VM <IPersistentVM>
[-ForceUpdate]
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
DisableCustomScriptExtension
Set-AzureVMCustomScriptExtension
[[-ReferenceName] <String>]
[[-Version] <String>]
-VM <IPersistentVM>
[-Disable]
[-ForceUpdate]
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
UninstalleCustomScriptExtension
Set-AzureVMCustomScriptExtension
[[-ReferenceName] <String>]
[[-Version] <String>]
-VM <IPersistentVM>
[-Uninstall]
[-ForceUpdate]
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
SetCustomScriptExtensionByUriLinks
Set-AzureVMCustomScriptExtension
[[-ReferenceName] <String>]
[[-Version] <String>]
[[-FileUri] <String[]>]
[-Run] <String>
[[-Argument] <String>]
-VM <IPersistentVM>
[-ForceUpdate]
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
说明
Set-AzureVMCustomScriptExtension cmdlet 设置 Azure 虚拟机自定义脚本扩展的信息。
示例
示例 1:设置虚拟机自定义脚本扩展的信息
PS C:\> $VM = Set-AzureVMCustomScriptExtension -VM $VM -ContainerName "Container01" -FileName "script1.ps1","script2.ps1" -Run "script1.ps1" -Argument "arg1 arg2";
PS C:\> New-AzureVM -Location "West US" -ServiceName $SVC -VM $VM;
此命令设置虚拟机自定义脚本扩展的信息。
示例 2:使用文件路径设置虚拟机自定义脚本扩展的信息
PS C:\> Set-AzureVMCustomScriptExtension -VM $VM -FileUri "http://www.blob.core.contoso.net/bar/script1.ps1","http://www.blob.core.contoso.net/baz/script2.ps1" -Run "script1.ps1" -Argument "arg1 arg2";
PS C:\> Update-AzureVM -ServiceName $SVC -Name $Name -VM VM;
此命令使用多个文件 URL 设置虚拟机自定义脚本扩展的信息。
参数
-Argument
指定一个字符串,该字符串提供此 cmdlet 在虚拟机上运行的参数。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SetCustomScriptExtensionByContainerAndFileNames
| Position: | 8 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
SetCustomScriptExtensionByUriLinks
| Position: | 8 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-ContainerName
指定存储帐户中的容器名称。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SetCustomScriptExtensionByContainerAndFileNames
| Position: | 2 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Disable
指示此 cmdlet 禁用扩展状态。
参数属性
| 类型: | SwitchParameter
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
DisableCustomScriptExtension
| Position: | 2 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-FileName
指定一个字符串数组,其中包含指定容器中 blob 文件的名称。
参数属性
| 类型: | String[]
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SetCustomScriptExtensionByContainerAndFileNames
| Position: | 3 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-FileUri
指定包含 Blob 文件的 URL 的字符串数组。
参数属性
| 类型: | String[]
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SetCustomScriptExtensionByUriLinks
| Position: | 2 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-ForceUpdate
指示未更新配置时,此 cmdlet 将配置重新应用到扩展。
参数属性
| 类型: | SwitchParameter
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 9 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
指定此 cmdlet 如何响应信息事件。
此参数的可接受值为:
- 继续
- 忽略
- 询问
- SilentlyContinue
- 停止
- Suspend
| 类型: | ActionPreference
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | infa |
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
指定信息变量。
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | 四 |
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Profile
指定此 cmdlet 从中读取的 Azure 配置文件。
如果未指定配置文件,此 cmdlet 将从本地默认配置文件中读取。
参数属性
| 类型: | AzureSMProfile
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-ReferenceName
指定扩展的引用名称。
此参数是一个用户定义的字符串,可用于引用扩展。
首次将扩展添加到虚拟机时指定。
对于后续更新,需要在更新扩展时指定以前使用的引用名称。
使用 Get-AzureVM cmdlet 返回分配给扩展的 ReferenceName。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 0 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Run
指定此 cmdlet 由虚拟机上的扩展运行的命令。
仅支持“powershell.exe”。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | RunFile, 指令 |
参数集
SetCustomScriptExtensionByContainerAndFileNames
| Position: | 7 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-StorageAccountKey
指定存储帐户密钥
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SetCustomScriptExtensionByContainerAndFileNames
| Position: | 6 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-StorageAccountName
指定当前订阅中的存储帐户名称。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SetCustomScriptExtensionByContainerAndFileNames
| Position: | 4 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-StorageEndpointSuffix
指定存储服务终结点。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
SetCustomScriptExtensionByContainerAndFileNames
| Position: | 5 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Uninstall
指示此 cmdlet 从虚拟机卸载自定义脚本扩展。
参数属性
| 类型: | SwitchParameter
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
UninstalleCustomScriptExtension
| Position: | 2 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Version
指定自定义脚本扩展的版本。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 1 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-VM
指定持久性虚拟机对象。
参数属性
| 类型: | IPersistentVM
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | InputObject |
参数集
(All)
| Position: | Named |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。