Jump to content
Sign in to follow this  
Guest Ridiz

Trouble with RunAsSet

Recommended Posts

Guest Ridiz

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!

Share this post

Link to post
Share on other sites
Guest Ridiz

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!

Share this post

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
Sign in to follow this