VMware Cloud Community
vcbtester1
Contributor
Contributor
Jump to solution

get-visession cmdlet is not recognized

Hi All,

Any idea how to get the get-visession cmdlet running? Its not recognized in my machine as valid cmdlet.

I see that its available in 5.0.1 onwards as per blog http://blogs.vmware.com/vipowershell/vcenter/

I also confirmed that my version is 5.0.1 (see below)

I need this to check the number of sessions connected to VC periodically. Any help would be appreciated.

PowerCLI Version
----------------
   VMware vSphere PowerCLI 5.0.1 build 581491
---------------
Snapin Versions
---------------
   VMware AutoDeploy PowerCLI Component 5.0 build 544967
   VMware ImageBuilder PowerCLI Component 5.0 build 544967
   VMware vCloud Director PowerCLI Component 1.5 build 581492
   VMware License PowerCLI Component 5.0 build 544881
   VMware vSphere PowerCLI Component 5.0 build 581435

Reply
0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can save the function Get-ViSession from the blog-post in a file, e.g. Get-ViSession.ps1. After that you can dot-source that file:

. .\Get-ViSession.ps1


to add the function to your session.

You can also add the function to your PowerShell profile with:

notepad $profile


Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

The Get-VISession the blog post refers to is a function, not a cmdlet.

Store the code from the blog post in a .ps1 file, then dot-source the .ps1 file

. ./file.ps1

Note that there is a blank between the 2 dots !

Now you can call the Get-VISession function.


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

RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can save the function Get-ViSession from the blog-post in a file, e.g. Get-ViSession.ps1. After that you can dot-source that file:

. .\Get-ViSession.ps1


to add the function to your session.

You can also add the function to your PowerShell profile with:

notepad $profile


Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos