Hi,
I use a Windows 7 Client which has no connection to the internet. I run PowerShell Verison 3 on this machine.
PS Z:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
3 0 -1 -1
I download the vmware powercli in version 6.5.2 with the save-module cmdlet. Then copied the Module Folders in my module path.
PS Z:\> $env:PSModulePath
Z:\Eigene Dateien\Dokumente\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
If i uderstand it right in version 3 of the powershell this should be enough when the modules where located in the module path. If i use them they will be loaded automatic. But in the moment its not working. If i run get-vm as example i get an error that the cmldet is not found.
PS Z:\> get-vm
get-vm : Die Benennung "get-vm" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt.
Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang.
In Zeile:1 Zeichen:1
+ get-vm
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (get-vm:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Has somebody an idea what i do wrong?
Ah, I think I see the issue.
You downloaded the PowerCLI modules from a PC with PowerShell v5.
That explains why you have versionnumber folder.
But that is only supported in PowerShell v5, not in v4 or v3.
The easiest way to fix that is to download the modules on a PC with PowerShell v4
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Do you see the PowerCLI modules when you do
Get-Module –ListAvailable
If yes, can you use the PowerCLI cmdlets after you do
Get-Module -Name VMware* -ListAvailable | Import-Module
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
no.
PS Z:\> $ENV:PSModulePath
Z:\Eigene Dateien\Dokumente\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files\Hewlett-Packard\PowerShell\Mo
dules
PS Z:\> Get-Module –ListAvailable
Verzeichnis: C:\Windows\system32\WindowsPowerShell\v1.0\Modules
ModuleType Name ExportedCommands
---------- ---- ----------------
Manifest ActiveDirectory {Get-ADRootDSE, New-ADObject, Rename-ADObject, Move-ADObject...}
Manifest AppLocker {Set-AppLockerPolicy, Get-AppLockerPolicy, Test-AppLockerPolicy, Get-AppLockerFileInformation...}
Manifest BitsTransfer {Add-BitsFile, Remove-BitsTransfer, Complete-BitsTransfer, Get-BitsTransfer...}
Manifest CimCmdlets {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSession...}
Script ISE {New-IseSnippet, Import-IseSnippet, Get-IseSnippet}
Manifest Microsoft.PowerShell.Diagnostics {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter...}
Manifest Microsoft.PowerShell.Host {Start-Transcript, Stop-Transcript}
Manifest Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}
Manifest Microsoft.PowerShell.Security {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}
Manifest Microsoft.PowerShell.Utility {Format-List, Format-Custom, Format-Table, Format-Wide...}
Manifest Microsoft.WSMan.Management {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSSP, Set-WSManQuickConfig...}
Script PSDiagnostics {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, Enable-PSTrace...}
Binary PSScheduledJob {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-JobTrigger...}
Manifest PSWorkflow {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn}
Manifest PSWorkflowUtility Invoke-AsWorkflow
Manifest TroubleshootingPack {Get-TroubleshootingPack, Invoke-TroubleshootingPack}
Verzeichnis: C:\Program Files\Hewlett-Packard\PowerShell\Modules
ModuleType Name ExportedCommands
---------- ---- ----------------
Binary HPOACmdlets {Add-HPOACertificate, Add-HPOADNS, Add-HPOAEBIPA, Add-HPOAIPv6Address...}
Looks like that folder is not taken into account.
Does this work?
Import-Module Z:\Eigene Dateien\Dokumente\WindowsPowerShell\Modules\VMware.VimAutomation.Core
Is that Z-drive by any chance a network share?
Did you try with a local folder, just to make sure it is not a network share thing.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hmm maybe the modules are corrupt
PS Z:\> Import-Module "Z:\Eigene Dateien\Dokumente\WindowsPowerShell\Modules\VMware.VimAutomation.Core"
Import-Module : Das angegebene Modul "Z:\Eigene Dateien\Dokumente\WindowsPowerShell\Modules\VMware.VimAutomation.Core" wurde nicht geladen, da in
keinem Modulverzeichnis eine gültige Moduldatei gefunden wurde.
In Zeile:1 Zeichen:1
+ Import-Module "Z:\Eigene Dateien\Dokumente\WindowsPowerShell\Modules\VMware.VimA ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (Z:\Eigene Datei...Automation.Core:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
PS Z:\> Import-Module "D:\PowerCLI\VMware.VimAutomation.Core"
Import-Module : Das angegebene Modul "D:\PowerCLI\VMware.VimAutomation.Core" wurde nicht geladen, da in keinem Modulverzeichnis eine gültige Moduldatei
gefunden wurde.
In Zeile:1 Zeichen:1
+ Import-Module "D:\PowerCLI\VMware.VimAutomation.Core"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (D:\PowerCLI\VMware.VimAutomation.Core:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
The error meens "The Module couldn't be load because there is no valid modulefile". I also copy the mentioned module to 😧 which is local drive.
PS D:\PowerCLI\VMware.VimAutomation.Core\6.5.2.6234650> dir
Verzeichnis: D:\PowerCLI\VMware.VimAutomation.Core\6.5.2.6234650
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 04.10.2017 13:26 Scripts
d---- 04.10.2017 13:27 VMware Remote Console
-a--- 07.08.2017 14:20 1672 about_ceip.help.txt
-a--- 07.08.2017 14:20 2126 about_invalid_certificates.help.txt
-a--- 07.08.2017 14:20 4369 about_obn.help.txt
-a--- 07.08.2017 14:20 3885 about_powercli_objects.help.txt
-a--- 07.08.2017 14:20 2192 about_runasync.help.txt
-a--- 07.08.2017 14:20 3070 about_server_authentication.help.txt
-a--- 07.08.2017 14:20 4432 about_uid.help.txt
-a--- 07.08.2017 14:20 4796 about_vimdatastore.help.txt
-a--- 07.08.2017 14:20 957 ComponentDescriptor-VMware.VimAutomation.ViCore.Cmdlets.xml
-a--- 07.08.2017 14:20 639 ComponentDescriptor-VMware.VimAutomation.ViCore.xml
-a--- 07.08.2017 14:20 64527 EULA.rtf
-a--- 07.08.2017 14:20 216552 ICSharpCode.SharpZipLib.dll
-a--- 07.08.2017 14:20 13799912 InternalVimService50.dll
-a--- 07.08.2017 14:20 288232 InventoryService55.dll
-a--- 07.08.2017 14:20 87399 open_source_licenses.txt
-a--- 07.08.2017 14:20 13304808 VimService65.dll
-a--- 07.08.2017 14:20 1623016 VMware.Vim.dll
-a--- 07.08.2017 14:20 56253 VMware.VimAutomation.Core.cat
-a--- 07.08.2017 14:20 15547 VMware.VimAutomation.Core.ps1
-a--- 07.08.2017 14:20 19869 VMware.VimAutomation.Core.psd1
-a--- 07.08.2017 14:20 246387 VMware.VimAutomation.Format.ps1xml
-a--- 07.08.2017 14:20 1232360 VMware.VimAutomation.ViCore.Cmdlets.dll
-a--- 07.08.2017 14:20 3926289 VMware.VimAutomation.ViCore.Cmdlets.dll-Help.xml
-a--- 07.08.2017 14:20 1942504 VMware.VimAutomation.ViCore.Impl.dll
-a--- 07.08.2017 14:20 113640 VMware.VimAutomation.ViCore.Interop.dll
-a--- 07.08.2017 14:20 279528 VMware.VimAutomation.ViCore.Types.dll
-a--- 07.08.2017 14:20 131560 VMware.VimAutomation.ViCore.Util10.dll
-a--- 07.08.2017 14:20 86504 VMware.VimAutomation.ViCore.Util10Ps.dll
Ah, I think I see the issue.
You downloaded the PowerCLI modules from a PC with PowerShell v5.
That explains why you have versionnumber folder.
But that is only supported in PowerShell v5, not in v4 or v3.
The easiest way to fix that is to download the modules on a PC with PowerShell v4
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
this looks like a good answer. I upgraded the Powershell Version to 5.1.
PS Z:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 14409 1005
Now the Errror is different and in the first case it looks like it will work
PS Z:\> get-vm
get-vm : The 'get-vm' command was found in the module 'VMware.VimAutomation.Core', but the module could not be loaded. For more information, run
'Import-Module VMware.VimAutomation.Core'.
At line:1 char:1
+ get-vm
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (get-vm:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
But then..
PS Z:\> Import-Module VMware.VimAutomation.Core
Import-Module : Die Datei oder Assembly "file:///Z:\Eigene
Dateien\Dokumente\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk\1.0.0.5334677\log4net.dll" oder eine Abhängigkeit davon wurde nicht gefunden. Der
Vorgang wird nicht unterstützt. (Ausnahme von HRESULT: 0x80131515)
At line:1 char:1
+ Import-Module VMware.VimAutomation.Core
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], FileLoadException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
or on 😧
PS Z:\> Import-Module "D:\PowerCLI\VMware.VimAutomation.Core"
Import-Module : Die Datei oder Assembly "file:///Z:\Eigene
Dateien\Dokumente\WindowsPowerShell\Modules\VMware.VimAutomation.Sdk\1.0.0.5334677\log4net.dll" oder eine Abhängigkeit davon wurde nicht gefunden. Der
Vorgang wird nicht unterstützt. (Ausnahme von HRESULT: 0x80131515)
At line:1 char:1
+ Import-Module "D:\PowerCLI\VMware.VimAutomation.Core"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], FileLoadException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
Maybe something gets broken when i copy the modules. I will try a fresh copy tomorrow.
Thank you for your help
I tried also to change the module path to d: but the error message is right. There is no log4net.dll in the folder
Directory: D:\PowerCLI
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 6.5.1.5... VMware.DeployAutomation {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-DeployRule...}
Binary 6.5.1.5... VMware.ImageBuilder {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxImageProfile, Export-EsxImageProf...
Manifest 6.5.2.6... VMware.PowerCLI
Binary 6.5.2.6... VMware.VimAutomation.Cis.Core {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Binary 6.5.1.5... VMware.VimAutomation.Cloud {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, Get-Catalog...}
Manifest 6.5.1.5... VMware.VimAutomation.Common
Binary 6.5.2.6... VMware.VimAutomation.Core {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpS...
Binary 6.0.0.5... VMware.VimAutomation.HA Get-DrmInfo
Binary 7.1.0.5... VMware.VimAutomation.HorizonView {Connect-HVServer, Disconnect-HVServer}
Binary 6.5.1.5... VMware.VimAutomation.License Get-LicenseDataManager
Binary 6.5.1.5... VMware.VimAutomation.PCloud {Connect-PIServer, Disconnect-PIServer, Get-PIComputeInstance, Get-PIDatacenter}
Manifest 1.0.0.5... VMware.VimAutomation.Sdk {Get-PSVersion, Get-InstallPath}
Binary 6.5.1.5... VMware.VimAutomation.Srm {Connect-SrmServer, Disconnect-SrmServer}
Binary 6.5.1.5... VMware.VimAutomation.Storage {Copy-VDisk, Export-SpbmStoragePolicy, Get-NfsUser, Get-SpbmCapability...}
Script 1.0 VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Binary 6.5.1.5... VMware.VimAutomation.Vds {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Export-VDPortGroup, Export-VDSwitc...
Binary 6.5.1.5... VMware.VimAutomation.vROps {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-OMAlertDefinition...}
Binary 6.5.1.5... VMware.VumAutomation {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Compliance...}
PS Z:\> Import-Module VMware.VimAutomation.Core
Import-Module : Die Datei oder Assembly "file:///D:\PowerCLI\VMware.VimAutomation.Sdk\1.0.0.5334677\log4net.dll" oder eine Abhängigkeit davon wurde
nicht gefunden. Das System kann die angegebene Datei nicht finden.
At line:1 char:1
+ Import-Module VMware.VimAutomation.Core
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
Do you now have PowerShell v5.1 on the isolated PC, or on the PC where you downloaded and saved the PowerCLI modules?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
hi,
so last update on this post. Thank you very much LucD you helped me a lot.
After i copy the module folder from my online pc to my offline pc via usb stick it works fine.
But its important that the modules where availiable on a local harddisk. It was not possible for me to load them from the network drive.