Highlighted
Hot Shot
Hot Shot

content_libray commands _powercli

Jump to solution

Hi Luc,

i am observing some issues uisnf content lib commands .

i am doing following  to make commands available (and they are available)

Update-Module vmware.powercli

Import-Module vmware.vimautomation.core

however it does not work  sometimes

New-ContentLibrary : The term 'New-ContentLibrary' 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\Administrator\Desktop\BPI.ps1:271 char:9

+ $conlib=New-ContentLibrary -Name "siteA con lib" -Datastore (get-data ...

+         ~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (New-ContentLibrary:String) [], Comma

   ndNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

0 Kudos
1 Solution

Accepted Solutions
Highlighted
User Moderator
User Moderator

The default is 'All'


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
14 Replies
Highlighted
User Moderator
User Moderator

What does the following show?

Get-Module -Name VMware* -ListAvailable

and also

Get-Module -Name VMware*


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

it happend when i am tryyig to create content lib .which is one of the part of the project script we have been discussing .

i think yu already have that link.

i have added import-module vmware.vimautomation.core  in the script .but even that it is failing to get command

0 Kudos
Highlighted
User Moderator
User Moderator

If you are doing this in HOL-2012-01-SDC - VMware vSphere Automation - PowerCLI, then, unfortunately, that lab is using PowerCLI 11.3.0.
While the Content Library cmdlets were introduced in PowerCLI 11.5.0.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

i have update using

update-module vmware.powercli .

it has worked many times as daily iam testing the project script .

i have seen content lib being created .

0 Kudos
Highlighted
User Moderator
User Moderator

That's strange, normally you have no Internet access in the HOL.
Can you confirm the update by doing

Get-Module -Name VMware* -ListAvailable


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

i am loggin in back however can yu try running the script from below on lab.its not completer but

it will

check linked mode configuration

update powercli

install posh-ssh

create ftp server on local control center

and create contet lib

implemeting vsphere best practices and features_powercli

0 Kudos
Highlighted
User Moderator
User Moderator

Ok, the Update-Module works for me (do it from a PS session that is started As Administrator).
Then creating and displaying Content Libraries works for me.

cl.jpg


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

it is working most of the times but today i got error which i posted .not sure what is the reason.

0 Kudos
Highlighted
User Moderator
User Moderator

When you encounter it again, do the Get-Module command.
Perhaps even in your script after the Update-Module.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

ok.just thought of asking if iam running

update-module vmware.powercli

or

install-module posh-ssh

do i need to import respective module .as i had to run this to use them .

0 Kudos
Highlighted
User Moderator
User Moderator

If you are on PS v3 or higher and if the module is installed in a directory listed in $env:PSModulePath, you don't need to do the Import-Module.


But, module autoloading is based on a file the PS engine creates.

It might be that this file is not updated after your Update-Module or Install-Module yet.
Or that the $PSModuleAutoLoadingPreference variable is not set.

Conclusion: the Import-Module is most probably not needed, but to be on the safe side it won't do any harm either


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Hot Shot
Hot Shot

well iam doing it on lab which is 5.1 ps version .

and i think installing directly from powershell gallery uses $env:PSModulePath only as this is what we discussed long time back as the advantage of instaling  latest versions of powercli directly from powershell gallery.(that was the magic part...)

however i will check $PSModuleAutoLoadingPreference.

0 Kudos
Highlighted
Hot Shot
Hot Shot

Or that the $PSModuleAutoLoadingPreference variable is not set.

checking above .well i dont see this  neither in variable: drive  nor in env: drive

what should i set it to ??

0 Kudos
Highlighted
User Moderator
User Moderator

The default is 'All'


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos