I am unable to use a variable in a new-udhtml

                New-UDHtml -Markup {
                    <div style="display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 20px;">
                    <div style="background-color: #0099CC; color: white; height: 150px; text-align: center; padding: 20px; display: flex; flex-direction: column; justify-content: center; box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.7);" onmouseover="this.style.backgroundColor='#2c3e50';" onmouseout="this.style.backgroundColor='#0099CC';">
                    <a href="$($variable)" style="display: block; text-align: center; text-decoration: none; color: inherit;" target="_blank">
                    <i class="fas fa-cog" style="font-size: 24px; margin-bottom: 10px;"></i>
                    <span>Tile 3</span>
                    </a>
                    </div>
                }

The variable is always listed as $variable but it must be a link to another online program.

Markup is a string so it’s converting your script block into a string literal. You’d need to use double quotes and escape your double quotes in the string.

New-UDHtml -Markup "
                    <div style=`"display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 20px;`">
                    <div style=`"background-color: #0099CC; color: white; height: 150px; text-align: center; padding: 20px; display: flex; flex-direction: column; justify-content: center; box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.7);`" onmouseover=`"this.style.backgroundColor='#2c3e50';`" onmouseout=`"this.style.backgroundColor='#0099CC';`">
                    <a href=`"$($variable)`" style=`"display: block; text-align: center; text-decoration: none; color: inherit;`" target=`"_blank`">
                    <i class=`"fas fa-cog`" style=`"font-size: 24px; margin-bottom: 10px;`"></i>
                    <span>Tile 3</span>
                    </a>
                    </div>
                "

Thanks a lot, that works!

Is it also possible to call a function from the html code?