Hi everyone. I am new in poershell and i wrote this code with your help and it works very good but now i want get values from user with window (like pop window then user can enter values) how can i modify this code please give me tips. Thanks very much.
PowerShell itself doesn’t have any native “pop up” for gathering information; it’s a command-line shell, not a graphical development environment. You can certainly use .NET to create a GUI, but it’s not just a simple line of code. SAPIEN’s PowerShell Studio product might be an easy way to get into GUI programming if you’ve not done it before, but I’ll caution you that it’s a BIG space.
You could alternately use the VisualBasic InputBox method for something quick and dirty; Google “PowerShell InputBox” and you’ll find several examples.
When you are getting input, especially from Read-Host, you can get into a rabbit hole. Enter a color and put 10, then you start adding code to validation and you have a complex script with loops. GUI’s are built to do validation and enter data, so if you have to get data then a form is your best bet. As Don suggested, you can use Sapien’s tool, but if you aren’t building a lot of forms I would go the cheap route and leverage a combination of Visual Studio and Powershell.