Jump to content

Trouble with RunAsSet


Recommended Posts

I am trying to write a script to uninstall something using the code below. This script uses an executable that must have local admin priveleges. This is being run on Windows XP.

$tempDir = EnvGet("TEMP") & "\SNETCFG"
$rcProg = "RemoveClient.exe"
$rcProgPath = $tempDir & "\" & $rcProg
$adminUser = "Administrator"
$adminPass = "password"

DirCreate ($tempDir)
FileInstall ("RemoveClient.exe", $rcProgPath, 1)

RunAsSet ($adminUser, @ComputerName, $adminPass)
RunWait ($rcProg, $tempDir)

DirRemove ($tempDir, 1)

Shutdown (2)

When I run this, I get:

AutoIT Error

Line: 0

RunWait ($rcProg, $tempDir)

Error: Unable to execute external program.

The system cannot find the path specified.

If I comment out the RunAsSet command, the script completes succesfully, but my executable does not because of a lack of rights. I have double checked NTFS permissions and everything appears to be correct.

Any suggestions? (yes I am a newbie so please be gentle) Thanks!

Link to post
Share on other sites

That worked! I banged my head against this all day and tried every possible variation (I thought) with no results. It's always good to get a set of fresh eyes.

Thank You JdeB for the quick reply!

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...