We were trying to put together a script which will delete temporary guest wifi accounts automatically. These accounts get configured to be marked as expired after 48 hours automatically. I put together a script to find and delete these accounts, but it kept failing…reason was that I needed to RUN AS ADMIN. Next step was to create a scheduled task, but this kept failing as it too was not running the Powershell script as admin.
So this is the batch file I created in my scheduled tasks to be able to call the Powershell script and run it as admin.
(If your PowerShell script needs to be run as an admin for whatever reason, the 4th line of the batch file will need to change a bit:)