Contents
- Background
- Introduction
- How did I use it
- Other ways I would use it
- Other ways you can use it
Background
Recently I had a reason to allow an end user at the company I work for to be able to clear the print queue on another remote computer from their own source computer. The reason is that there is a business process that requires the user to have the remote computer process a print request that then outputs it back to a label printer near the original source computer.
Originally, I wanted to use a PowerShell script since I am familiar with PowerShell. However, I was instructed that they wanted the trigger of the process to be email based. Some other requirements was to have this script take the last hour of logs from Event Viewer and save it in a separate folder on the remote computer, as well as grab the newest .txt file from another folder and store it with the Log outputs. Having that information would be beneficial to troubleshooting what happened on that remote computer down the road.
Introducing Mr. Automate
So here is where Microsoft Power Automate comes in. I personally had never had a reason to use it up until this project landed in my lap. But I have wanted to check it out before this, so I jumped at the chance.
Before we go into what I did I am going to cover what Power Automate is quick.
Microsoft Power Automate is a cloud-based platform that allows users to automate business processes and tasks across a range of applications and services. With Power Automate, users can create automated workflows called “flows” to streamline repetitive tasks, synchronize files, and receive notifications.
One of the key features of Power Automate is its ability to integrate with a wide range of applications and services, including Microsoft 365 and Azure, as well as popular third-party services such as Salesforce, Dropbox, and Twitter. This allows users to automate a wide range of business processes, including data management, communication, and collaboration.
Power Automate also offers a range of pre-built connectors and templates that make it easy for users to get started with automation. For example, users can use a template to automate the process of sending an email when a new file is added to a folder in OneDrive, or to receive a notification when a new tweet is posted with a specific hashtag.
In addition to automating business processes, Power Automate also provides tools for building custom apps and integrating them with other services. For example, users can build a custom app to collect data from a form and then use Power Automate to process the data and send it to a database or spreadsheet.
How did I use Power Automate
I began by first creating a new email account in our Office 365 environment. I didn’t want to use anyone else’s’ for obvious reasons. Once I had set that email account up and gotten a “Power Apps” license applied to it, I then logged into the browser version of Power Automate. (to be honest I didn’t know that there were two different versions of Power Automate at this time). After finding where to create a new “flow” I discovered the option for Power Automate to watch for emails with a specific string in the subject line from specific users. This fit one of my criteria well (not having a script directly on the source computer) and meant I could restrict it down to just a few select people. Perfect!
So now I needed some way of taking a new email as a trigger and have it then set off a PowerShell script that would take a snippet of the remote computer’s windows logs, the newest important .txt file, and then clear the print queue. A task called “Desktop Flows” seemed to be a likely solution!
This is where I encountered my first snag. I discovered that I needed to upgrade my licensing to be able to have Power Automate be able to operate from the Online version of Power Automate to the Desktop Version. (This is also about when I discovered that there even was desktop version, in hindsight it makes complete sense). So back to Microsoft I went to obtain a license. A little bit of searching made me discover that the license I needed was in fact an Unattended RPA license.
There is a lovely article about this that you can find here. https://jussiroine.com/2021/11/planning-for-licensing-in-unattended-and-attended-rpa-solutions-with-power-automate-desktop/
After getting the licensing sorted, I was able to push on, and set up a flow inside of the desktop version of power automate. This flow ran a PowerShell script that first cleared the print queue on the remote computer (shutting down the Print Spooler and reenabling it after clearing the queue). Then extracted the last hour of logs and deposited them into a folder and copied the latest .txt file into the same log folder. (Storing it in a folder that auto named itself based on the day and time.)
Its worth mentioning that in order for me to be able to choose the remote computer inside of Power Automate I had to start and setup the “Power Automate machine runtime” application.
To polish this off I went back to the browser version of power automate set it to use the unattended version. Gave it the needed credentials. And then added a final step of sending out an email to the necessary people letting them know it completed.
Other ways I plan to use Power Automate
I intend on expanding on this process I made and setting up a way for the end user to also recall that txt file for reviewing via an email. Also, I want to have another flow that auto texts the IT Dept when the end user sends an email with the keyword “Alert”. This would allow us to be notified in after hours in a non-intrusive way to us and using the form of communication this end user is most comfortable with.
Other ways you can use Power Automate
There are many other things you can do with Microsoft Power Automate. So, I figured I would give a couple ideas below.
- Automate repetitive tasks: Power Automate can be used to automate repetitive tasks, such as sending emails, copying files, and updating data.
- Integrate applications and services: Power Automate allows you to integrate a wide range of applications and services, such as Microsoft 365, Azure, Salesforce, and Dropbox. This allows you to automate processes that involve multiple applications and services. One thought I had is integrating SharePoint and Dropbox since some vendors of ours only use Dropbox and we could potentially have our employee only have to put files into a specific folder on SharePoint to have to upload to Dropbox eliminating another employee task.
- Receive notifications: You can use Power Automate to receive notifications when specific events occur, such as when a new file is added to a folder, or something is posted in Teams.
- Synchronize data: Power Automate can be used to synchronize data between different applications and services.
- Build custom apps: Power Automate provides tools for building custom apps and integrating them with other services. For example, you could build an app to collect data from a form and then use Power Automate to process the data and send it to a database or spreadsheet.