question

csuser0db1952cb89b-3466 avatar image
0 Votes"
csuser0db1952cb89b-3466 asked RamyaHarinarthini-MSFT commented

Can you explain the error in the command executed in the screenshot and guide how to resolve it

![![96720-image.png][1]][1]


azure-stack-hub
image.png (83.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RamyaHarinarthini-MSFT avatar image
0 Votes"
RamyaHarinarthini-MSFT answered RamyaHarinarthini-MSFT commented

@csuser0db1952cb89b-3466 Welcome to Microsoft Q&A, Thank you for posting your here!!

Make sure to set the VM configuration object in $VirtualMachine first then set the operating system

Create the VM configuration object

$VmName = "VirtualMachinelatest"
$VmSize = "Standard_A1"
$VirtualMachine = New-AzVMConfig -VMName $VmName -VMSize $VmSize

$VirtualMachine = Set-AzVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName "MainComputer" -Credential $Credential -ProvisionVMAgent

$VirtualMachine = Set-AzVMSourceImage -VM $VirtualMachine -PublisherName "MicrosoftWindowsServer" -Offer "WindowsServer" -Skus "2016-Datacenter" -Version "latest"

For complete script please check the document here

Hope this helps!
Kindly let us know if the above helps or you need further assistance on this issue.


Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@csuser0db1952cb89b-3466 Just checking in to see if the above answer helped. If this answers your query, do click “Mark as Answer” and Up-Vote for the same, which might be beneficial to other community members reading this thread. And, if you have any further query do let us know.

0 Votes 0 ·