Jump to content

script to copy files as admin


Recommended Posts

I'm a newbie in forum and autoit scripting.

I'm trying to run the script, but getting errors:

#NoTrayIcon

RunAsSet("admin id", "domain name", "password")

$DFTUSER = StringReplace(@DesktopCommonDir, 'All Users\Desktop', 'Default User')

FileCopy("\\servername\dir1\dir2\dir3\filename", $DFTUser & '\Desktop\');

RunAsSet()

Later I came to know that RunAsSet is no longer autoit function, so I used RunAs, but didn't work.

Could you please help me what should I use instead of RunAsSet?

Thank you.

Link to comment
Share on other sites

Hello,

The following script is runinng, but don't copy, how to debug the program? Could you please share your experience?

#NoTrayIcon

Local $sUserName="username"

Local $sPassword="password"

Local $sServerLoc="\\servername\dir1\dir2\filename.txt"

Local $sServerDes="C:\dir3\dir4\"

RunAs($sUserName, @ComputerName, $sPassword, 0, @ComSpec, @SystemDir)

$DFTUSER = StringReplace(@DesktopCommonDir, 'All Users\Desktop', 'Default User')

FileCopy($sServerLoc, $DFTUser & $sServerDes)

;

Any response is appreciated.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...