No need for risky GenAI generated powershell. You can use JSL you just have to figure out how to access the correct window (this can depend on how you wish to run the script)
Names Default To Here(1);
pw = Get Window List()[2];
pw[ScriptBox(1)] << Show Embedded Log(1);
You can also run this automatically using Global Window State Handler
-Jarmo