I think having the current windows user account set to administrator instead of just non-admin fixes the problem. But I'm not 100% sure about it. I couldn't find a way to automatically grant access from just the script itself. Plus I don't have this problem that your having so it's probably the computer permissions being set to manual run instead of just auto execution. You could also check the windows defender settings to see how these permissions are managed. But I try seeing if your account is full admin or not first.