0

So, I am trying to make a startup batch script that runs as an administrator during windows startup.

I have my script here:

powershell -Command "Start-Process cmd -Verb RunAs -ArgumentList '/c fsutil behavior set disablelastaccess 3"

The only problem I am facing here is that every time the batch script gets executed, I always get a prompt to enter administrator password. Is there any additional way to remove this popup and directly run the command?

1 Answers1

0

Instead of your powershell command, try runas:

runas /savecred /user:Administrator "fsutil behavior set disablelastaccess 3"

The first time it runs, you will be asked to provide the Administrator password at the command line. After that point, it should run without any prompt because of the /savecred flag. So run it once before putting it in your startup script.

Jamesfo
  • 524
  • 6
  • 11