/build/static/layout/Breadcrumb_cap_w.png

Run As not working inside of Wise Script

We have Windows XP SP2 as our corporate desktop. Each machine does have reg.exe in the %SYS32% folder. We are deploying a script that has to run as the Current User. This script does many things and one of the things it has to do is execute the following commands.reg delete HKLM\Software\iprotech\i2ksys\paths /freg add HKLM\Software\microsoft\Windows\CurrentVersion\RunOnce /v CleanUp /d "C:\WINDOWS\system32\cmd.exe /c del C:\WINDOWS\Custom1.exe"Both of these command work when run from a DOS window but when run inisde of a Wise Script they fail.Here is my script in 2 formats

Get Environment Variable COMPUTERNAME into Variable COMPUTERNAME
Set Variable USERNAME to localadmin
Set Variable DOMAIN to %COMPUTERNAME%
Set Variable PASSWORD_ to L0g0nN0w
Set Variable REGPATH to reg delete HKLM\Software\iprotech\i2ksys\paths /f
Call DLL %SYS32%\KERNEL32.DLL Function MultiByteToWideChar
Call DLL %SYS32%\KERNEL32.DLL Function MultiByteToWideChar
Call DLL %SYS32%\KERNEL32.DLL Function MultiByteToWideChar
Call DLL %SYS32%\KERNEL32.DLL Function MultiByteToWideChar
Call DLL %SYS32%\ADVAPI32.DLL Function CreateProcessWithLogonW
Exit Installation


////////////////////////////////////////////////////////////////////////////////////////////////

OR here is a copy/paste of the code



item: Get Environment Variable
Variable=COMPUTERNAME
Environment=COMPUTERNAME
end
item: Set Variable
Variable=USERNAME
Value=localadmin
end
item: Set Variable
Variable=DOMAIN
Value=%COMPUTERNAME%
end
item: Set Variable
Variable=PASSWORD_
Value=L0g0nN0w
end
item: Set Variable
Variable=REGPATH
Value=reg delete HKLM\Software\iprotech\i2ksys\paths /f
end
item: Call DLL Function
Pathname=%SYS32%\KERNEL32.DLL
Function Name=MultiByteToWideChar
Argument List=310
Argument List=311
Argument List=40USERNAME
Argument List=21-1
Argument List=40USERNAMEW
Argument List=211024
Return Variable=2
Flags=00100000
end
item: Call DLL Function
Pathname=%SYS32%\KERNEL32.DLL
Function Name=MultiByteToWideChar
Argument List=310
Argument List=311
Argument List=40PASSWORD_
Argument List=21-1
Argument List=40PASSWORD_W
Argument List=211024
Return Variable=2
Flags=00100000
end
item: Call DLL Function
Pathname=%SYS32%\KERNEL32.DLL
Function Name=MultiByteToWideChar
Argument List=310
Argument List=311
Argument List=41%REGPATH%
Argument List=21-1
Argument List=40COMMANDLINEW
Argument List=211024
Return Variable=2
Flags=00100000
end
item: Call DLL Function
Pathname=%SYS32%\KERNEL32.DLL
Function Name=MultiByteToWideChar
Argument List=310
Argument List=311
Argument List=40DOMAIN
Argument List=21-1
Argument List=40DOMAINW
Argument List=211024
Return Variable=2
Flags=00100000
end
item: Call DLL Function
Pathname=%SYS32%\ADVAPI32.DLL
Function Name=CreateProcessWithLogonW
Argument List=40USERNAMEW
Argument List=40DOMAINW
Argument List=40PASSWORD_W
Argument List=311
Argument List=42
Argument List=40COMMANDLINEW
Argument List=310
Argument List=82
Argument List=42
Argument List=s168
Argument List=¹1`
Argument List=r0HPROCESS
Argument List=²0HTHREAD
Argument List=³0PROCESSID
Argument List=³0THREADID
Return Variable=3RETURN
Flags=00100000
end
item: Exit Installation
end


Not sure what I am doing wrong here so any help would be great !!

0 Comments   [ + ] Show comments

Answers (5)

Posted by: anonymous_9363 14 years ago
Red Belt
0
Wouldn't it be simpler to use Active Setup to run the script?
Posted by: pjgeutjens 14 years ago
Red Belt
0
Seems to me like the registry entries you're trying to delete there make it unnecessary to run them as a specific user (they're in HKLM), so like Ian said, just use Active Setup and incorporate them in your main installation
Posted by: mhsl808 14 years ago
Fifth Degree Brown Belt
0
This is more complicated than that. We are deploying a MSI with a custom .MST via Group Policies. So the MSI runs with elevated rights but inside of the custom .MST we call a "Custom Action" and once this gets spawned it is no longer running with Admin rights. Inside of this custom action (which is an EXE) we need to do a RunAs command.
Posted by: anonymous_9363 14 years ago
Red Belt
0
Good spot, Pieter. I missed that.

once this gets spawned it is no longer running with Admin rights. So why not set it to run in System context?

This is more complicated than that Only because you're making it so! :) Why not just add the offending key/value to the RemoveRegistry table and the additional key to the Registry table?
Posted by: nheim 14 years ago
10th Degree Black Belt
0
Hi,
now is definitely the time for a complete redesign of this stuff!
This looks to me, like you are trying to shoot from the backside trough the chest right into the eye...
Could you please outline the tasks in pseudo code, which you are doing with this CA?
After that, we can help you, to choose the right approach to solve them one by one.
Regards, Nick
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ