< Back

Add-AzureRmVMAdditionalUnattendContent

Tue Jan 29, 2019 9:36 pm

NAME Add-AzureRmVMAdditionalUnattendContent



SYNOPSIS

Adds information to the unattended Windows Setup answer file.





SYNTAX

Add-AzureRmVMAdditionalUnattendContent [-VM] <PSVirtualMachine> [[-Content] <String>] [[-SettingName] {AutoLogon | FirstLogonCommands}]

[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]





DESCRIPTION

The Add-AzureRmVMAdditionalUnattendContent cmdlet adds information to the unattended Windows Setup answer file. Specify additional base 64 encoded

.xml formatted information that this cmdlet adds to the unattend.xml file.





PARAMETERS

-Content <String>

Specifies base 64 encoded XML formatted content. This cmdlet adds the content to the unattend.xml file. The XML content must be less than 4 KB

and must include the root element for the setting or feature that this cmdlet inserts.



Required? false

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-SettingName <SettingNames>

Specifies the name of the setting to which the content applies. The acceptable values for this parameter are:



- FirstLogonCommands



- AutoLogon



Required? false

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VM <PSVirtualMachine>

Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM

(./Get-AzureRmVM.md)cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig (./New-AzureRmVMConfig.md)cmdlet.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

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 (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

PSVirtualMachine

Parameter 'VM' accepts value of type 'PSVirtualMachine' from the pipeline





OUTPUTS

Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine







NOTES









Example 1: Add content to unattend.xml



PS C:\\> $AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03"

PS C:\\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id

PS C:\\> $Credential = Get-Credential

PS C:\\> $VirtualMachine = Set-AzureRmVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName "Contoso26" -Credential $Credential

PS C:\\> $AucContent = "<UserAccounts><AdministratorPassword><Value>" + "Password" +

"</Value><PlainText>true</PlainText></AdministratorPassword></UserAccounts>";

PS C:\\> $VirtualMachine = Add-AzureRmVMAdditionalUnattendContent -VM $VirtualMachine -Content $AucContent -SettingName "AutoLogon"



The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the

$AvailabilitySet variable.



The second command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to

the virtual machine. The virtual machine belongs to the availability set stored in $AvailabilitySet.



The third command creates a credential object by using the Get-Credential cmdlet, and then stores the result in the $Credential variable. The

command prompts you for a user name and password. For more information, type `Get-Help Get-Credential`.



The fourth command uses the Set-AzureRmVMOperatingSystem cmdlet to configure the virtual machine stored in $VirtualMachine.



The fifth command assigns content to the $AucContent variable. The content includes a password.



The final command adds the content stored in $AucContent to the unattend.xml file.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... endcontent

Get-AzureRmAvailabilitySet

Set-AzureRmVMOperatingSystem

New-AzureRmVMConfig