VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Unable to get the chart

Hi,

I am unable to get the pie chart from the attached script, please help.

Error :

ConvertTo-Base64 : The term 'ConvertTo-Base64' 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 D:\Pie_Report_4.0.ps1:55 char:29

+    $Script:PiechartImgSrc = ConvertTo-Base64 ($FileName + ".png")

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

    + CategoryInfo          : ObjectNotFound: (ConvertTo-Base64:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You have to copy and include that function (ConvertTo-Base64) as well.

function ConvertTo-Base64() {

     Param (

         [string] $ImgSrc

     )

     return [Convert]::ToBase64String((Get-Content $ImgSrc -Encoding byte))

}


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

I assume you are using the PureStoragePowerShellToolkit as the source.

Since the ConvertTo-Base64 function is not a builtin cmdlet, you will have to include the function.

As an earlier version of the PureStoragePowerShellToolkit also did.


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

0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Hi LucD,

I just copied a bit of code to generate piechart html report for Folder level VM Used CPU and Free CPU

When I tried, I am getting that error.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You have to copy and include that function (ConvertTo-Base64) as well.

function ConvertTo-Base64() {

     Param (

         [string] $ImgSrc

     )

     return [Convert]::ToBase64String((Get-Content $ImgSrc -Encoding byte))

}


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

0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Thank you very much, that worked

0 Kudos