question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I can't figure out how to upgrade a machine instance via powershell.

See original GitHub issue

This 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:open
  • Created 7 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
quoctruongcommented, Jan 9, 2017

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?

0reactions
Cirzencommented, Aug 16, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found