To get the Instance uuid of the current Task during script runtime as a string variable. Use the following method:
param($CurrentInstanceUuid)
Write-Host $CurrentInstanceUuid
This will get a string variable like fbfa8388-7a23-46a9-a318-7f86f4b96955. Always start with the param() header as the first line of your PowerShell script. If so, you are able to access the current Instance uuid anywhere in your script.