Introduction
Today I will show you how to create a PowerAutomate Desktop flow that asks you when you want to shut down your Computer.
The only prerequisites is PowerAutomate Desktop and a Microsoft account.
You can also watch the whole walkthrough as video: https://youtu.be/0UEtlwJ8_Es
1. Add new flow
Open PowerAutomate Desktop and click on New Flow
.
You can add any name you like. I'm naming mine Example Shutdown Flow
.
2. Select date dialog
Move a Display select data dialog
to the editor field.
You can set the Dialog title
and the dialog description
as you want.
Select by prompt for
Date and Time
. This is very important.
Now press save and the dialog should close.
3. Difference between times
Now we need the difference between the time selected and the current time in seconds.
First add a Get current date and time
action.
Just click save
and don't change any values.
Second you have to add a Subtract dates
action.
In the From date
field click on the {X} symbol on the right side. Then select SelectedDate
.
Do the same thing in the Substract date
field but ow select CurrentDateTime
.
Set Get difference in
to Seconds
.
4. Shutdown
Add an if
element. Set First operand
to the variable ButtonPressed
. And Second operand
to OK
.
With this condition the flow only continues when you selected Ok in the dialog. If you click cancel or close Shutdown doesn't get executed.
Add a Wait
statement into the if statement and set TimeDifference
as Duration
.
Then add a Shutdown computer
action under the wait statement. Optionally you can select Force
so that the PC shutdowns also when there are for instance unsaved files.
5. Run
Now we're finished. Save the flow, close the editor window and then click on run.
Top comments (0)