PowerShell script won't run as part of a logon script.

I have a PowerShell script which checks to ensure certain backups have taken place. The script checks the date of certain flag / semaphore files and shows a message if the files are too old (which one is in this test)

This works fine when manually run from the following batch file
Powershell.exe -executionpolicy Bypass -File  "Check-If-Backup-Failed.ps1"

Open in new window

but not when the same command line is added to the 'logon.bat' logon script.

What am I doing wrong (I presume it is permissions somehow) ?

NOTE: I don't get an error when I login - it just does nothing.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shreedhar EtteTechnical ManagerCommented:
Place the PowerShell script file in shared location and use the UNC path in

Powershell.exe -executionpolicy Bypass -File  "\\servername\sharer\Check-If-Backup-Failed.ps1"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AL_XResearchAuthor Commented:
Thank you for spotting my stupid and idiotic mistake ! How could I have missed that ?

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.