google-cloud-powershell icon indicating copy to clipboard operation
google-cloud-powershell copied to clipboard

Error when running AppendPsModulePath.ps1 on Windows Server 2012 R2

Open ivannaranjo opened this issue 8 years ago • 1 comments

When running AppendPsModulePath.ps1 in Windows Server 2012 R2 (the version available on GCE) I get the following error:

Get-ItemPropertyValue : The term 'Get-ItemPropertyValue' 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:\Program Files (x86)\Google\Cloud
SDK\google-cloud-sdk\platform\PowerShell\GoogleCloud\1.0.0.3\AppendPsModulePath.ps1:15 char:24
+         $installPath = Get-ItemPropertyValue $hklmPath InstallLocation
+                        ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-ItemPropertyValue:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

C:\Program Files (x86)\Google\Cloud
SDK\google-cloud-sdk\platform\PowerShell\GoogleCloud\1.0.0.3\AppendPsModulePath.ps1 : Can not find Google PowerShell.
False\google-cloud-sdk\platform\PowerShell does not exist.
At line:1 char:1
+ .\AppendPsModulePath.ps1 | clip
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,AppendPsModulePath.ps1

It seems that the Get-ItemPropertyValue cmdlet is not available in the version of PowerShell that comes installed with Windows Server 2012 R2. The version is:

PS C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell\GoogleCloud\1.0.0.3> $PSVersionTable.PSV
ersion

Major  Minor  Build  Revision
-----  -----  -----  --------
4      0      -1     -1

The cmdlet Get-ItemPropertyValue seems like it is only available in PowerShell 5.1 or newer.

ivannaranjo avatar Mar 06 '17 14:03 ivannaranjo

Getting the same situation here. I cant manage to load the cmdlets into powershell Any suggestion perhaps?

juanse417 avatar Aug 07 '19 14:08 juanse417