goss34 Posted August 16, 2010 Share Posted August 16, 2010 Hi Guys, I have writted a script that runs a line of code changes some of the wording then should run the line. The problem is it displays it correct but the RunAsWait command just doesnt seem to do it afterwards(See code) $Runline = "*\\LocalDomain\software$\Supported\Microsoft\Visio\2010\Installation Files\setup.exe* /adminfile ~Visio2010.MSP~ /config ~config.xml~" Local $a_rep[3][2] = [["*", '"'], ["~", '"']] For $i = 0 To Ubound($a_rep, 1) - 1 $Runline = StringRegExpReplace($Runline, "\Q" & $a_rep[$i][0] & "\E", $a_rep[$i][1]) Next ConsoleWrite($Runline) RunAsWait("UserAccount", "UserDomain", "UserPassword", 0, $Runline) MsgBox(0, "done", $Runline) Can anyone help to identify why it is not actually running the file? It works for a simple MSI install because it doesnt need the extra quotes above Visio.MSP and config.xml - see below - msiexec /I *\\LocalDomain\software$\Supported\Install.exe* /passive Thanks Dan P.S. If you are wondering why the change of characters its because the parameters are being passed from a webpage which is confusing the quotes and backslashes - This is the only way i could find to get the string to read how i want. Link to comment Share on other sites More sharing options...
enaiman Posted August 16, 2010 Share Posted August 16, 2010 Replace your * and ~ with "" (double double-quotes) and try again. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
goss34 Posted August 17, 2010 Author Share Posted August 17, 2010 Hi enaiman, That doesnt seem to do anything. If you notice as it currently is the last msgbox displays the output exactly how i want but the prior runaswait just doesnt seem to process the line which i dont understand. Any more ideas? Thanks Dan Link to comment Share on other sites More sharing options...
doudou Posted August 17, 2010 Share Posted August 17, 2010 P.S. If you are wondering why the change of characters its because the parameters are being passed from a webpage which is confusing the quotes and backslashes - This is the only way i could find to get the string to read how i want.Does this mean that your script is run from within a Web server context?If yes, it could be the major problem. UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ Link to comment Share on other sites More sharing options...
goss34 Posted August 17, 2010 Author Share Posted August 17, 2010 Hi doudou, Not really, basically the full script is just an EXE that sits waiting for 3 parameters to be passed to it and then it processes the EXE on the local machine using those parameters. Parameter 1 - Name Parameter 2 - Install parameters e.g. "msiexec /i "C:\install.exe" /passive" Parameter 3 - Registry key Hopefully that makes sense to you. Cheers Dan Link to comment Share on other sites More sharing options...
doudou Posted August 17, 2010 Share Posted August 17, 2010 Well, there are still many various reasons, why RunAsWait would fail. It is possible, however, that it fails not but "setup.exe" does: you pass Visio2010.MSP and config.xml without their paths, so setup looks for it in the current working directory, which is (by AutoIt docs on RunAs) @SystemDir, doesn't find them and silently exits. UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ Link to comment Share on other sites More sharing options...
goss34 Posted August 17, 2010 Author Share Posted August 17, 2010 Any chance you can elaborate on the reasons because im not finding anything at the moment. If i run this from a command line it works wonderfully - "\\LocalDomain\software$\Supported\Microsoft\Visio\2010\Installation Files\setup.exe" /adminfile "Visio2010.MSP" /config "config.xml" The above is exactly what i get back in the message box and the console write so why doesnt the RunAsWait just run it like it has for every other product this has worked for ? Thanks Dan Link to comment Share on other sites More sharing options...
doudou Posted August 17, 2010 Share Posted August 17, 2010 Any chance you can elaborate on the reasons because im not finding anything at the moment.If i run this from a command line it works wonderfully - "\\LocalDomain\software$\Supported\Microsoft\Visio\2010\Installation Files\setup.exe" /adminfile "Visio2010.MSP" /config "config.xml"Please, read this again carefully:It is possible, however, that it fails not but "setup.exe" does: you pass Visio2010.MSP and config.xml without their paths, so setup looks for it in the current working directory, which is (by AutoIt docs on RunAs) @SystemDir, doesn't find them and silently exits.Then try supplying full paths to Visio2010.MSP and config.xml. UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ Link to comment Share on other sites More sharing options...
goss34 Posted August 17, 2010 Author Share Posted August 17, 2010 Sorry doudou i meant to say i tried that and again the console write and msgbox shows me what that its outputting correct but the runaswait again doesnt seem to do anything. I never see setup.exe flash up in task manager so its as if it doesnt even begin to process the line. Thanks Dan Link to comment Share on other sites More sharing options...
goss34 Posted August 17, 2010 Author Share Posted August 17, 2010 Hi Guys, I have the same issue with another application: "\\LocalDomain\software$\Supported\mRemote\1.50\Installation Files\mRemote_1.50_Setup_EN.exe" /S The RunAsWait just seems to ignore this completely once again... (Its strange because the MSIEXEC statements are more complicated but work fine??? Thanks Dan Link to comment Share on other sites More sharing options...
doudou Posted August 17, 2010 Share Posted August 17, 2010 Ensure your UserAccount has browse and execute right on \\LocalDomain\software$ and all subdirectoriesTry supplying appropriate working directory parameter to RunAs (instead of full paths on command line) UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ Link to comment Share on other sites More sharing options...
goss34 Posted August 17, 2010 Author Share Posted August 17, 2010 (edited) UserAccount has permissions to source. Set a working directory and it does nothing again. I have just noticed if i try and run this it does not work: RunAsWait("UserAccount", "UserDomain", "UserPassword", 0, '"\\Local.Domain\software$\Supported\CamStudio\2.0\Installation Files\CamStudio.msi" /passive') However if i run this it does: RunAsWait("UserAccount", "UserDomain", "UserPassword", 0, 'Msiexec.exe /I "\\Local.Domain\software$\Supported\CamStudio\2.0\Installation Files\CamStudio.msi" /passive') The difference being "Msiexec.exe /I" included on the second line but not the first. Is the RunAsWait command not understanding the network path correctly or something? Thanks Dan Edited August 17, 2010 by goss34 Link to comment Share on other sites More sharing options...
doudou Posted August 17, 2010 Share Posted August 17, 2010 I have just noticed if i try and run this it does not work: RunAsWait("UserAccount", "UserDomain", "UserPassword", 0, '"\\Local.Domain\software$\Supported\CamStudio\2.0\Installation Files\CamStudio.msi" /passive') This doesn't work per definition: Run* (unlike ShellExecute) doesn't open user files, it runs executables only. I've noticed that your first post refers "LocalDomain" not "Local.Domain" on the command line. What is it in the end? UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now