Hi,
I'm a new user of AutoIT and Forum then sorry if this question has already been answered, however I tried to find a solution to this problem and so far I have not found it.
I just want to copy some files from a network share to Program Files directory, but to do this I need to run with administrative credentials, because it will run by common users.
I try this script:
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <WinAPIFiles.au3>
#include <Constants.au3>
;Credentials
Local $sUserName = "adminuser"
Local $sPassword = "adminpwd"
Local $sDomain = "domain"
RunAs($sUserName , $sDomain , $sPassword ,2,@ScriptName,@ScriptDir)
MsgBox($MB_ICONWARNING, "Auto Atualização do AX-PDV", "Este procedimento irá atualizar o AX PDV. Feche o AX PDV antes de inicar a atualização e clique em OK. ESTE PROCEDIMENTO IRÁ INICIAR AUTOMATICAMENTE EM 10 SEGUNDOS OU CLICANDO EM OK", 10)
;Copia as dlls atuais da pasta POSUpdates do servidor da loja para as pastas raiz e Extensions
FileCopy("\\homeserver\POSUpdates\Extension\","C:\Program Files (x86)\Microsoft Dynamics AX\60\Retail POS\Extensions",$FC_OVERWRITE))
FileCopy("\\homeserver\POSUpdates\Raiz\","C:\Program Files (x86)\Microsoft Dynamics AX\60\Retail POS",$FC_OVERWRITE))
but didn't work.
Then I try it:
RunAsWait($sUserName, $sDomain, $sPassword, 0, @ComSpec & " /c copy /Y \\homeserver\POSUpdates\Extension\ C:\temp", "", @SW_HIDE)
but it didn't work too.
What am I doing wrong?
thank you all!