Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Trying to create a automation flow for a scheduled refresh where data is getting fetched from Sharepoint Lists and later unpivoted in Power Query (which is working fine). In order to refresh the excel file, shell script opens the file and stays open for some time during which data gets refreshed and upon closing below MACRO script saves the excel file.
The problem is that below message box needs responding to
The code invokes a method using the wscript.shell object and works fine when you are logged into the system. Unfortunately we need to this run on an unattended system. However due to the security policy the screen lock kicks in. When that happens it is no longer possible to invoke the wscript.shell object. Below link.
wsh - VBScript not working when PC is locked - Stack Overflow
However, the commands to open the Excel file and then do a graceful shutdown using macro do not have this limitation
Can you please guide how to reolve this, perhaps any changes in Macros also to see what is causing the error message to appear. If that can be removed the automation should work fine i guess.
I am beginner trying to find the solution.
Thanks
Hi, @Anonymous ;
The error code means that it need two parameters in one function.
In powershell we don't use commas to separate arguments. Each argument is separated by space in PowerShell.
How do I pass multiple variables to a powershell function? - Stack Overflow
2 arguments were passed to a function which expect... - Microsoft Power BI Community
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Using office 365
Check out the July 2025 Power BI update to learn about new features.