I've created an XML Dialog Window with a button and added the add_click Event to the script:
#Write-Host "Previewing group"
When I run the script above manually from ISE, it work fine.
So, I'll assume you're already aware of the serious negative security implications of Invoke-Expression, and no go into that ;).
Have you tried using a fully-qualified file path for the CSV? As-is, you're loading it from "the current directory," which may not be what you think it is, when this runs as a WPF. Obviously, since the ISE sets the current directory, it's working there.
You must be logged in to reply to this topic.