2
votes

I am trying to create a Windows Server 2008 VM in Azure using PowerShell. Unfortunately I don't know the correct syntax to use.

I know Server 2012 is $skuName = "2012-R2-Datacenter"...I am looking to create a Windows Server 2008 R2 SP1 VM but don't know the correct label to input.

Does anyone know?

2

2 Answers

3
votes

Use the Get-AzureVMImageSku cmdlet to retrieve the Skus:

Get-AzureVMImageSku -PublisherName "MicrosoftWindowsServer" -Offer "WindowsServer" -Location westus | select Skus

Output:

2008-R2-SP1                           
2012-Datacenter                       
2012-R2-Datacenter                    
2016-Nano-Docker-Test                 
2016-Nano-Server-Technical-Preview    
2016-Technical-Preview-with-Containers
Windows-Server-Technical-Preview 

Answer:

2008-R2-SP1
0
votes

I think you can read this: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-create-windows-powershell-resource-manager/. and try the following command:

$vm = Set-AzureRmVMSourceImage -VM $vm -PublisherName MicrosoftWindowsServer -Offer WindowsServer -Skus 2008-R2-SP1 -Version "latest"