I am trying to create a windows form using PowerShell and then manipulate the data entered. The problem I am having is that I can get the code to work if I copy/paste it into a PowerShell window however I cannot get it to work if I save the exact same code to a PS1 file. I don't understand that.
If you try out the example in this article: http://technet.microsoft.com/en-us/library/ff730941.aspx it will work fine when you paste it into an open command prompt. If you try to save this code as a PS1 and run the PS1 in the PowerShell window I get nothing back when click OK on the dialog.
Can someone help me understand why it doesn't work as a PS1 file?
$x
was not assigned the string entered in the field. However, if I echo$objTextBox.Text
then it does contain the text that I entered. For some reason, this assignment$x=$objTextBox.Text
does not seem to be working (scoping problem?). However, for me, it was the same, regardless of whether I used the console for a script. – David