Edit

Share via


Set-AzureVMCustomScriptExtension

Sets information for an Azure virtual machine custom script extension.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

SetCustomScriptExtensionByContainerAndFileNames (Default)

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>]
Set-AzureVMCustomScriptExtension
    [[-ReferenceName] <String>]
    [[-Version] <String>]
    [[-FileUri] <String[]>]
    [-Run] <String>
    [[-Argument] <String>]
    -VM <IPersistentVM>
    [-ForceUpdate]
    [-Profile <AzureSMProfile>]
    [-InformationAction <ActionPreference>]
    [-InformationVariable <String>]
    [<CommonParameters>]

Description

The Set-AzureVMCustomScriptExtension cmdlet sets information for an Azure virtual machine custom script extension.

Examples

Example 1: Set information for a virtual machine custom script extension

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;

This command sets information for a virtual machine custom script extension.

Example 2: Set information for a virtual machine custom script extension using a file path

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;

This command sets information for a virtual machine custom script extension using multiple file URLs.

Parameters

-Argument

Specifies a string that supplies an argument that this cmdlet runs on the virtual machine.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetCustomScriptExtensionByContainerAndFileNames
Position:8
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
SetCustomScriptExtensionByUriLinks
Position:8
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ContainerName

Specifies the container name within the storage account.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetCustomScriptExtensionByContainerAndFileNames
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Disable

Indicates that this cmdlet disables the extension state.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DisableCustomScriptExtension
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-FileName

Specifies a string array that contains the names of the blob files in the specified container.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetCustomScriptExtensionByContainerAndFileNames
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-FileUri

Specifies a string array that contains the URLs of the blob files.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetCustomScriptExtensionByUriLinks
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ForceUpdate

Indicates that this cmdlet re-apply a configuration to an extension when the configuration has not been updated.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:9
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend

Parameter properties

Type:ActionPreference
Default value:None
Supports wildcards:False
DontShow:False
Aliases:infa

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InformationVariable

Specifies an information variable.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:iv

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Parameter properties

Type:AzureSMProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ReferenceName

Specifies the reference name for the extension.

This parameter is a user-defined string that can be used to refer to an extension. It is specified when the extension is added to the virtual machine for the first time. For subsequent updates, you need to specify the previously used reference name while updating the extension. The ReferenceName assigned to an extension is returned using the Get-AzureVM cmdlet.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Run

Specifies the command this cmdlet runs by the extension on the virtual machine. Only "powershell.exe" is supported.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:RunFile, Command

Parameter sets

SetCustomScriptExtensionByContainerAndFileNames
Position:7
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-StorageAccountKey

Specifies the storage account key

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetCustomScriptExtensionByContainerAndFileNames
Position:6
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-StorageAccountName

Specifies the storage account name in the current subscription.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetCustomScriptExtensionByContainerAndFileNames
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-StorageEndpointSuffix

Specifies the storage service endpoint.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SetCustomScriptExtensionByContainerAndFileNames
Position:5
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Uninstall

Indicates that this cmdlet uninstalls the custom script extension from the virtual machine.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UninstalleCustomScriptExtension
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Version

Specifies the version of the custom script extension.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VM

Specifies the persistent virtual machine object.

Parameter properties

Type:IPersistentVM
Default value:None
Supports wildcards:False
DontShow:False
Aliases:InputObject

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.