I can't figure out how to upgrade a machine instance via powershell.
See original GitHub issueThis doc says it’s possible via the console and gcloud, so I expect to be able to do it from powershell too.
I naively tried this:
PS C:\Users\rennie> $link
SelfLink
--------
https://www.googleapis.com/compute/v1/projects/surferjeff-test2/zones/us-west1-b/machineTypes/n1-standard-2
PS C:\Users\rennie> $sqlInstance
CanIpForward : False
CpuPlatform : Intel Broadwell
CreationTimestamp : 2016-12-14T14:52:42.150-08:00
Description :
Disks : {}
Id : 7717844925080695766
Kind : compute#instance
MachineType : https://www.googleapis.com/compute/v1/projects/surferjeff-test2/zones/us-west1-b/machineTypes/n1-st
andard-1
Metadata : Google.Apis.Compute.v1.Data.Metadata
Name : sql-server-1
NetworkInterfaces : {nic0}
Scheduling : Google.Apis.Compute.v1.Data.Scheduling
SelfLink : https://www.googleapis.com/compute/v1/projects/surferjeff-test2/zones/us-west1-b/instances/sql-serv
er-1
ServiceAccounts : {Google.Apis.Compute.v1.Data.ServiceAccount}
Status : RUNNING
StatusMessage :
Tags : Google.Apis.Compute.v1.Data.Tags
Zone : https://www.googleapis.com/compute/v1/projects/surferjeff-test2/zones/us-west1-b
ETag :
PS C:\Users\rennie> $sqlInstance.MachineType = $link
PS C:\Users\rennie> $sqlInstance
CanIpForward : False
CpuPlatform : Intel Broadwell
CreationTimestamp : 2016-12-14T14:52:42.150-08:00
Description :
Disks : {}
Id : 7717844925080695766
Kind : compute#instance
MachineType : @{SelfLink=https://www.googleapis.com/compute/v1/projects/surferjeff-test2/zones/us-west1-b/machine
Types/n1-standard-2}
Metadata : Google.Apis.Compute.v1.Data.Metadata
Name : sql-server-1
NetworkInterfaces : {nic0}
Scheduling : Google.Apis.Compute.v1.Data.Scheduling
SelfLink : https://www.googleapis.com/compute/v1/projects/surferjeff-test2/zones/us-west1-b/instances/sql-serv
er-1
ServiceAccounts : {Google.Apis.Compute.v1.Data.ServiceAccount}
Status : RUNNING
StatusMessage :
Tags : Google.Apis.Compute.v1.Data.Tags
Zone : https://www.googleapis.com/compute/v1/projects/surferjeff-test2/zones/us-west1-b
ETag :
PS C:\Users\rennie> Set-GceInstance $sqlInstance
Set-GceInstance : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Set-GceInstance $sqlInstance
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-GceInstance], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Google.PowerShell.ComputeEngine.SetGceInstanceCmdlet
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Upgrade virtual machine version in Hyper-V on Windows ...
To upgrade the virtual machine configuration version by using Windows PowerShell, use the Update-VMVersion cmdlet. Run the following command ...
Read more >Update-Help - Module: Microsoft.PowerShell.Core
The Update-Help cmdlet downloads the newest help files for PowerShell modules and installs them on your computer. You need not restart PowerShell to...
Read more >Perform an in-place upgrade of Windows Server
If your Windows Server version doesn't include Powershell you can find this information in the registry. Open Registry Editor, go to the ...
Read more >Manage Windows Virtual Machines with PowerShell Direct
To learn more about these cmdlets, see Enter-PSSession and Exit-PSSession. Run a script or command with Invoke-Command. PowerShell Direct with ...
Read more >Use PowerShell to create a VM with Accelerated Networking
This article describes how to use Azure PowerShell to create a Windows virtual machine (VM) with Accelerated Networking (AccelNet) enabled.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @SurferJeffAtGoogle, I was doing some more reading and it seems that the Update verb is supposed to be used to bring a resource up-to-date whereas the Set verb is more to modify data on an existing resource. So actually I think in this case, the Set verb makes more sense. What do you think?
I understand Jeff’s take here, but I think that what he’s proposing would be better implemented by a Commit() method on the Instance class. Part of the issue is that a large number of the properties on that class have public setters whereas perhaps they shouldn’t. The more PowerShell way to do it in my opinion is as Quoc suggests, and give the settable properties their own parameters on the Set-GceInstance cmdlet