We need to run a PowerShell script to set the IPv6 address of a Windows 2012 R2 server VM (vSphere 6.0 or 6.5) after the VM has been cloned and sys-prepped.
The script is uploaded to C:\windows\temp
using VMware guest tools and is executed automatically using the credentials of a local administrator account.
It gets executed in PowerShell but the functions called fail with an "access denied" error message.
UAC is active on the OS but the local security policy setting for "UAC: Behaviour of the elevation prompt for administrators in admin approval mode" is set to disabled. The script can be run manually in PS in any mode but only succeeds if the PS is started in administrator mode.
The question is, how can we get the script to run in Administrator mode without any user interaction at all, or being able to use a pre-stored credential set. The script also has to have 3 arguments passed to it.
All the answers I have found so far require user interaction (not possible) or storing an encrypted password, which doesn't work due to the sysprep following cloning.