I am trying to use powershell to setup a process that off boards users and doing the AD side of things is great but I am not sure how to use powershell to interact with our other software that only has a gui.
For example user management in studio3T where they only have a web UI or an application that you can download and run locally.
There are a few options:
- Use AutoIT or some similar automation framework. Generally, this is pretty easy and gets the job done. Your security folks may hate you (AutoIT binary hashes are basically all assumed to be malware IoCs at this point),
- Depending on how the GUI works, you may be able to reverse engineer the calls made by the application and just make those calls yourself. For a Web UI, you can use something like BurpeSuite or even just the FireFox developer tools to catch the web calls and then modify/replay those as desired. For a console application, it could be trickier, as you may need to either load the software’s libraries (DLLs) or figure out database calls. It all depends on how the user data is stored and updated.
- Using P/Invoke you can load several functions from the Win32 API, specifically FindWindowEx and EnumChildWindows to locate the GUI application and any specific form items you want to manipulate (e.g. TextBoxes to fill, Buttons to click). You can then modify properties or send clicks. You’ll probably hate yourself at the end of this project, but you’ll learn a lot.
Python can do it quite well. Look for certain pixels, click if they have a certain value.
As others have said it’s better to use other methods like apis where there is context but it’s definitely doable.
If it’s on the web, I’ve used selenium for years to get around apis and websites that don’t support it.
I wouldn’t personally
What if your automation clicks the wrong button after an update? GUI is for humans not scripts.
I mean yes, but updates can also break scripts. I’d say less likely, but if the automation solves an annoying issue, just go for it. It’s good to understand though that the automation needs adjustment from time to time
but im lazy and I dont want to have to manually do it every time 😅
Api if it has one. Otherwise AutoIt or Autohotkey
You can also use OCR libraries to read text or match colors.
As others have said - automating something with a GUI can get nasty. That being said, PowerAutomate isn’t terrible, nor is UiPath. I’ve also used Autohotkey, but it has a steep learning curve.
Its been quite a few years, but used Selenium to interact with GUIs for these kind of things. This included onboarding/offboarding tasks.
Last time I wanted to automate something on Windows (3 years ago), PowerAutomate did the job quite well.