VMware Cloud Community
jvm2016
Hot Shot
Hot Shot
Jump to solution

content_libray commands _powercli

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

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The default is 'All'


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

View solution in original post

Reply
0 Kudos
14 Replies
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

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 .

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

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 .

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

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.

Reply
0 Kudos
jvm2016
Hot Shot
Hot Shot
Jump to solution

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 ??

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

The default is 'All'


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

Reply
0 Kudos