-
1. Re: Having trouble installing Power Cli
peetz Dec 9, 2018 10:34 AM (in response to vmk2014)Have you tried running 'Import-Module VMware.VimAutomation.Core' ?
I guess this will also throw an error, but which one?
-
2. Re: Having trouble installing Power Cli
vmk2014 Dec 9, 2018 10:44 AM (in response to peetz)Yes, i tried and it throws an error.
-
3. Re: Having trouble installing Power Cli
LucD Dec 9, 2018 11:19 AM (in response to vmk2014)It looks as if your PowerCLI installation is not correct, you might have a mix of versions installed.
Can you run
$PSVersionTable
$env:PSModulePath.Split(';')
Get-Module -Name VMware* -ListAvailable | Select Name,Version,ModuleBase
Get-PSSnapin -Name VMware* -Registered
Get-WmiObject -Class Win32_Product -Filter "name like '%PowerCLI%'" | Select Name,Version
-
4. Re: Having trouble installing Power Cli
vmk2014 Dec 9, 2018 8:17 PM (in response to LucD)Hi LucD,
Please find the output. Before that i would to say in order to fix previous error, i did uninstalled power cli forcefully multiple times and even deleted VMware power cli folder from C drive but not resolved
PS C:\temp> .\test.ps1
Name Value
---- -----
PSVersion 5.1.14393.2608
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2608
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
C:\Users\adminmnt\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\Windows\system32\WindowsPowerShell\v1.0\Modules
C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell\
C:\Program Files\Microsoft Monitoring Agent\Agent\AzureAutomation\7.3.396.0
Name : VMware.Vim
Version : 6.7.0.10334489
ModuleBase : C:\Users\adminmnt\Documents\WindowsPowerShell\Modules\VMware.Vim\6.7.0.10334489
Name : VMware.VimAutomation.Cis.Core
Version : 11.0.0.10335701
ModuleBase : C:\Users\adminmnt\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Cis.Core\11.0.0.10335701
Name : VMware.VimAutomation.Common
Version : 11.0.0.10334497
ModuleBase : C:\Users\adminmnt\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Common\11.0.0.10334497
Name : VMware.VimAutomation.Sdk
Version : 11.0.0.10334495
ModuleBase : C:\Users\adminmnt\Documents\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk\11.0.0.10334495
Get-PSSnapin : No Windows PowerShell snap-ins matching the pattern 'VMware*' were found. Check the pattern and then
try the command again.
At C:\temp\test.ps1:7 char:1
+ Get-PSSnapin -Name VMware* -Registered
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (VMware*:String) [Get-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : NoPSSnapInsFound,Microsoft.PowerShell.Commands.GetPSSnapinCommand
-
5. Re: Having trouble installing Power Cli
LucD Dec 9, 2018 9:09 PM (in response to vmk2014)That all looks ok.
One more thing, did you also delete the folder C:\Program Files (x86)\VMware\Infrastructure\, if it should still be there?Next step, can you run the following?
Import-Module -Name VMware.PowerCLI -VerboseGet-Module -Name VMware*
Something else you could try, provided you have access to a local administrator account on your station.
Remove the current PowerCLI installation, and then install PowerCLI with the AllUsers scope.
Install-Module -Name VMware.PowerCLI -Scope AllUsers -Confirm:$false -
6. Re: Having trouble installing Power Cli
vmk2014 Dec 9, 2018 9:29 PM (in response to LucD)LucD,
I did follow the steps and even did the clean un-installation but always throws an error after installation
PS C:\temp> Get-Module VMware.PowerCLI -ListAvailable | Uninstall-Module -Force
PS C:\temp> Get-Module -ListAvailable -Name VMware.* | where {$_.Version -like “11.0.0.*”} | Uninstall-Module -Force
PS C:\temp> Get-Module -ListAvailable -Name VMware.*
Directory: C:\Users\admin\Documents\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 6.7.0.1... VMware.Vim
PS C:\temp> Get-Module -ListAvailable -Name VMware.* | where {$_.Version -like “6.7.0.*”} | Uninstall-Module -Force
PS C:\temp> Get-Module -ListAvailable -Name VMware.*
PS C:\temp> Get-Module VMware* -ListAvailable
PS C:\temp> Find-Module -Name VMware.PowerCLI
Version Name Repository Description
------- ---- ---------- -----------
11.0.0.... VMware.PowerCLI PSGallery This Windows PowerShell module contains VMware.P...
PS C:\temp> Install-Module -Name VMware.PowerCLI -Scope AllUsers -Confirm:$false
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
PackageManagement\Install-Package : A command with name 'Export-VM' is already available on this system. This module
'VMware.VimAutomation.Core' may override the existing commands. If you still want to install this module
'VMware.VimAutomation.Core', use -AllowClobber parameter.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
+ ... $null = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],
Exception
+ FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.Pack
ageManagement.Cmdlets.InstallPackage
-
error.JPG 87.1 K
-
-
7. Re: Having trouble installing Power Cli
vmk2014 Dec 9, 2018 9:33 PM (in response to vmk2014)After installation it shows output
PS C:\temp> Get-Module VMware* -ListAvailable
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 6.7.0.1... VMware.Vim
Script 11.0.0.... VMware.VimAutomation.Cis.Core {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script 11.0.0.... VMware.VimAutomation.Common
Script 11.0.0.... VMware.VimAutomation.Sdk
PS C:\temp> Get-PowerCLIVersion
Get-PowerCLIVersion : The term 'Get-PowerCLIVersion' 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 line:1 char:1
+ Get-PowerCLIVersion
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-PowerCLIVersion:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\temp>
-
8. Re: Having trouble installing Power Cli
LucD Dec 9, 2018 9:38 PM (in response to vmk2014)You shouldn't test on the module version for the uninstall.
PowerCLI has multiple versions.
The easiest is to just delete all folders starting with VMware.
Or run
Get-Module -Name VMware* -ListAvailable |
Uninstal-Module -Force -Confirm:$false
-
9. Re: Having trouble installing Power Cli
LucD Dec 9, 2018 9:40 PM (in response to vmk2014)When you run
Get-Module -Name VMware* -ListAvailable
you should see more lines (see my previous screenshot)
-
10. Re: Having trouble installing Power Cli
vmk2014 Dec 9, 2018 9:53 PM (in response to LucD)sorry not allowing.
PS C:\temp> Get-Module -Name VMware* -ListAvailable | Unistall-Module -Force -Confirm:$false
Unistall-Module : The term 'Unistall-Module' 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 line:1 char:43
+ Get-Module -Name VMware* -ListAvailable | Unistall-Module -Force -Con ...
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Unistall-Module:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-
11. Re: Having trouble installing Power Cli
LucD Dec 9, 2018 9:55 PM (in response to vmk2014)I think you have a typo in there, that should be Uninstall-Module.
-
12. Re: Having trouble installing Power Cli
vmk2014 Dec 9, 2018 10:02 PM (in response to LucD)LucD,
I didnt find any VMware folder under programm(x86) path
S C:\temp> Get-Module -Name VMware* -ListAvailable | Unistal-Module -Force -Confirm:$false
nistal-Module : The term 'Unistal-Module' is not recognized as the name of a cmdlet, function, script file, or
perable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
gain.
t line:1 char:43
Get-Module -Name VMware* -ListAvailable | Unistal-Module -Force -Conf ...
~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Unistal-Module:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
thanks
vmk
-
13. Re: Having trouble installing Power Cli
vmk2014 Dec 9, 2018 10:03 PM (in response to LucD)Yup, corrected it but same result
-
14. Re: Having trouble installing Power Cli
vmk2014 Dec 9, 2018 10:06 PM (in response to LucD)Yes, now it worked.
PS C:\temp> Get-Module -Name VMware* -ListAvailable |Uninstall-Module -Force -Confirm:$false
PS C:\temp>
PS C:\temp> Get-Module -Name VMware* -ListAvailable