Search code examples
google-cloud-platformgoogle-cloud-ops-agent

The term 'googet' is not recognized as the name of a cmdlet, function, script file, or operable program


I am following the instructions in here to install the Ops agent on my local Windows machine.

These are the steps that I follow in PowerShell (as admin):

(New-Object Net.WebClient).DownloadFile("https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.ps1", "${env:UserProfile}\add-google-cloud-ops-agent-repo.ps1") Invoke-Expression "${env:UserProfile}\add-google-cloud-ops-agent-repo.ps1 -AlsoInstall"

As soon as I execute this, the output is:

googet : The term 'googet' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\bot_runner_01\add-google-cloud-ops-agent-repo.ps1:171 char:10
+   if (! (googet listrepos | Select-String -quiet "https://packages.cl ...
+          ~~~~~~
    + CategoryInfo          : ObjectNotFound: (googet:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

googet : The term 'googet' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\bot_runner_01\add-google-cloud-ops-agent-repo.ps1:198 char:24
+   if (! $Version -and (googet listrepos | Select-String -quiet "https ...
+                        ~~~~~~
    + CategoryInfo          : ObjectNotFound: (googet:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

googet : The term 'googet' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\bot_runner_01\add-google-cloud-ops-agent-repo.ps1:205 char:10
+   if (! (googet installed google-cloud-ops-agent 2>&1 | Select-String ...
+          ~~~~~~
    + CategoryInfo          : ObjectNotFound: (googet:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

No changes made.

How can I fix this? thank you


Solution

  • As Jeff and Paul stated, this is simply because the googet command line tool is not (yet) installed.

    GooGet is a Windows package manager developed by and used by Google. It's used to package and install the Ops Agent.

    The GooGet project lives on GitHub here: https://github.com/google/googet. You can get the latest releases there.

    For the lazy, here's a scary one-liner from the Google Cloud docs to install the utility:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
    Invoke-WebRequest https://github.com/google/googet/releases/download/v2.13.0/googet.exe -OutFile $env:temp\googet.exe;
    & "$env:temp\googet.exe" -root C:\ProgramData\GooGet -noconfirm install -sources `
    https://packages.cloud.google.com/yuck/repos/google-compute-engine-stable googet;
    Remove-Item "$env:temp\googet.exe"