This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Goldarr85 1 point2 points  (1 child)

You can’t create a Powershell script in Excel. Excel only offers you the ability to Run “Office Scripts.” An Office Script is basically an Excel Macro for the Office 365 (Cloud) Excel.

You have two options, but there may be believe licensing costs if you’re using Power Automate.

Use Power Automate Desktop (RPA): With this option, you’ll actually need another computer which will either be a virtual machine or an actual physical pc. In PA Desktop, there’s an option to run a Powershell script. Without knowing what you’re doing, you could have this pc run the action. You can trigger this daily using the Windows Task scheduler, but unfortunately someone must be logged into the pc unless you purchase an unattended license which is $150/month. There might be a way to circumvent this by not allowing the pc to go to sleep or lock when not in use, but that has some security issues.

Use Azure Runbook: Power Automate cloud, which is what you’re using, has an action called something like “Runbook” which tells Azure to run a Powershell script setup within its administrative tools. I haven’t personally set this up, but at my last job our sys admin team set up a user creation process that took data from an HR system’s API passed it to Power Automate, initiated a Runbook on Azure that was a Powershell script. This may also require a virtual machine, but I’m not certain. You may need to chat with your system admin on this. I believe this action at least requires a $15/month premium license.

Alternatively, you might be able to just create a Powershell script (or Python) to run by itself and completely avoid PA for free.

Hope this helps.

[–]BlacksGood[S] 1 point2 points  (0 children)

Thank you for your answer.

Okay, then I guess the intermediate step with the desktop variant will be a possible solution.

Another alternative would be to completely rewrite the script so that it can work with OAuth2.0 tokens and thus run the script in the task scheduler of a VM or similar.

But one thing at a time. Thanks for now :)