One of the more common tasks for an administrator is to write a script for a helpdesk employee or a fellow admin who is maybe not so PowerShell savvy (yet). Many of you like to package that script as an executable file to prevent the user from “experimenting” with your code and messing things up in the process.
From what we hear, it is quite common for these users to come back and say they only see a flashing window when they try to run your script. Now you have to go and explain that this is a console window flashing and they need to open a console to run that exe or script from there.
After wasting this perfectly good explanation you most likely have to go in person and set up a shortcut for the user to do all you just explained.
Let’s face it, PowerShell is a console language, but not everyone is familiar or comfortable with using a console.
So here you are, trying to make your life easier by writing a script only to have to go into either development mode and make that script a GUI application or to go into teaching mode and lecture helpdesk employees on the use of consoles.
If only there was an easier way …
I did what many do today, I searched the internet for a script and modified it to suit my purpose. So here is my shoutout to Martin Pugh at https://thesurlyadmin.com/, thanks for the network speed script!
Here is what it looks like when you run the script. Pretty simple. The seasoned admins among you know that it gets squirrely when there are many more servers and content scrolls. Consoles have buffer limits and, for some reason, those more inclined to use a mouse, have an inexplicable dislike for anything in a console.
But wait, Notepad, everyone knows how to use Notepad, right?
Now lets package that script with the Windows Application engine and see what happens.
Much better. Anyone familiar with Notepad can handle that.
The File and Edit menus provide the usual functions, you can save the output of your script as a text file, the edit menu can find and copy specific text, so if things go wrong it is quite easy for the user to provide you with actual feedback and error messages.
Additionally, there is an automatically generated About box in the Help menu which contains all the information you specified in the version resource while packaging.
Now you can actually determine what version your users run by asking them to simply go to the about box.
It took about ten minutes and some minor modifications to make a simple command line script into a Windows Notepad style application.
There are some limitations of course but we here at SAPIEN think you will find this very useful in enabling others to use your scripts.
As always, if you have any ideas, comments, feedback, please use our feedback forum and reference this post.