How to copy extracted content to a protected folder?

I need to copy the “ActiveDirectory” PowerShell module folder after prefetching
From: __download\ActiveDirectory
To: C:\Windows\System32\WindowsPowerShell\v1.0\Modules\ActiveDirectory
The destination folder needs to be created during the copy process.

Here is my Actionscript.

======================================================================
prefetch 6fa2c36a06aaf1fe8be3e309a14307dba0a91ded sha1:6fa2c36a06aaf1fe8be3e309a14307dba0a91ded size:389817 http://INB14BFXSRV01V.concentrix.com:52311/Uploads/6fa2c36a06aaf1fe8be3e309a14307dba0a91ded/ActiveDirectory.tmp sha256:b08d073923947f0f39d06b9ddca700cf7b767fe790e291e76dbd29119d5d1c78

extract 6fa2c36a06aaf1fe8be3e309a14307dba0a91ded __Download\ActiveDirectory

waithidden xcopy __download\ActiveDirectory C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ActiveDirectory /E /I /Q /H /Y

  • The prefetch and extraction are working as expected.
  • The process is failing at the copy stage because of UAC.
  • I tried extracting the folder directly to the destination as well as using the native copy command but both fail equally.

How can I run this action with elevated status?
Is there a better way to accomplish this action?

Cheers,
Emil

Is this failing when run as an action or when testing in the debugger?

The debugger runs under user context but the action is run by the BESClient service in the SYSTEM context and shouldn’t be impacted by UAC.

You could also consider doing the extract straight into the destination folder.

You’ll need an ‘action uses wow64 redirection false’, otherwise you reference to system32 will be redirected to syswow64.

That did it.
AHH!.. the joy of inexperience.

Thanks for the quick reply,
Emil

1 Like

Thanks for the details about user context. I may edit the action to do as you suggest.

Cheers,
Emil