
These can be used to display information and gather user input. You will see a simple form just like this one below: $LocalPrinterForm.text = "LazyAdmin - PowerShell GUI Example"

# Define the size, title and background color Just copy-paste the code below in the PowerShell ISE and click on run # Init PowerShell GuiĪdd-Type -AssemblyName Also, we need to define a size for the form (width, height), title and background color. This is something that took me 30 minutes to figure out… I simply thought I could show the form and handle the input below it in PowerShell. But any code after you displayed the form won’t be executed until you close the form. The basics of the PowerShell GUIīefore we start creating a form is it important to know that the PowerShell script is run sequentially. We can look up the Ip Address so if the user can select a model and fill in a name we are done. So I figured, the PowerShell script only needs the printer model, Ip Address and a name. Now I could just install all the printers, but that would only be confusing and resulting in a long list of printers. I created a PowerShell script that I could run remotely to do this in the background, but that would require them to call me, so I could run the script in the background. They will need to create a TCP/IP port, find the IP Address of the printer, select the driver and give a printer name.

Our users can install a printer themselves, but because they are not listed on the print server they can easily search for the printer. Because of double natting, we can’t deploy printers with a print server. I work for a construction company and our construction sites are connected over a 4G IPVPN network with the datacenter. In this article I will use one of my own projects as an example, so let me first tell a bit about the problem I needed to solve. In this article, I will explain how you can create a simple GUI for your script and help you through the basic obstacles. We all love PowerShell for the simplicity and efficientness when it comes to scripting, but for normal users working with a CLI isn’t something they are used to. And users and command line isn’t the best combination, so let’s take a look at using the PowerShell GUI.

But this week I needed to create a script that could be run by the users themselves. All with a single purpose to automate my IT work as much as possible. I have created many PowerShell scripts for the last couple of years.
