matt65 Posted June 3, 2010 Share Posted June 3, 2010 Hi, I am creating an autoit script which will silently install IIS7 onto a Windows 7 PC. I have found the required syntax of a CMD is: start /w pkgmgr /l:log.etw /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI When I run this on the PC from the CMD prompt, IIS7 features are installed with no errors reported. When I put this exact same syntax into a autoit script, I receive the error "An attempt was made to load a program with an incorrect format". The way in which I am calling the command is: RunWait("cmd.exe /c ""start /w pkgmgr.exe /l:log.etw /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI"" ","",@SW_SHOW) I have also tried: RunWait(@ComSpec & " /c ""start /w pkgmgr.exe /l:log.etw /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI"" ","",@SW_SHOW) Both of them result in the exact same error and no IIS features are installed. Is anyone able to offer any suggestions on why running the command in a CMD prompt will succeed, but running the exact same command via autoit is resulting if failures? I have attached the script I am using, it will only execute the command if your PC is Windows 7. I appreaciate any assistance anyone is able to offer. Mattdeploy-silent-IIS7.au3 Link to comment Share on other sites More sharing options...
Fire Posted June 3, 2010 Share Posted June 3, 2010 (edited) Hi and you are Welcome.Check the Autoit help file for syntax of runwait() It must beRunWait("cmd.exe /c " & "start /w pkgmgr.exe /l:log.etw /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI",@ScriptDir,@SW_SHOW)And please when you copy/paste some autoit code use :place here your codeGood Luck Edited June 3, 2010 by Fire [size="5"] [/size] Link to comment Share on other sites More sharing options...
Juvigy Posted June 3, 2010 Share Posted June 3, 2010 Try : RunWait(@COMSPEC & " /c start /w pkgmgr.exe /l:log.etw /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI") Link to comment Share on other sites More sharing options...
matt65 Posted June 3, 2010 Author Share Posted June 3, 2010 Thank you both very much for your speedy replies. Unfourtunately neither of these resolved the issue, the same error prompt is appearing. Thanks Fire for the heads up on the correct syntax, means I have a lot of scripts to now update Is the RunWait function the correct choice for what I am after? Link to comment Share on other sites More sharing options...
Juvigy Posted June 3, 2010 Share Posted June 3, 2010 What exactly is the error? Maybe you need to specify full path to the pkgmgr.exe ? Link to comment Share on other sites More sharing options...
Fire Posted June 3, 2010 Share Posted June 3, 2010 Hmm i change @Scriptdir to @Systemdir Ok try this RunWait("cmd.exe /c " & "start /w pkgmgr /l:log.etw /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI",@SystemDir,@SW_SHOW) [size="5"] [/size] Link to comment Share on other sites More sharing options...
UEZ Posted June 3, 2010 Share Posted June 3, 2010 Try this: $prg = "pkgmgr.exe" $param1 = " /l:log.etw " $param2 = " /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI " $run = @ComSpec & " /c " & $prg & $param1 & $param2 $start = RunWait($run, @WindowsDir, @SW_MAXIMIZE) BR, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
matt65 Posted June 4, 2010 Author Share Posted June 4, 2010 Thanks to all for your assistance, unfourtunately none of the above worked in this instance. I found another command to run using dism, which is the replacement for pkgmgr on Windows 7. It is most likely related to my problems above, when calling DISM I kept getting an error that the 64-bit version needs to be used. It turns out that on a 64-bit PC certain internal commands get somewhat confused in that they run a 64-bit exe but are using the 32-bit dll. My fix was to use the following: RunWait("cmd.exe /k " & "C:\Windows\SysNative\dism.exe /online /enable-feature /featurename:""IIS-WebServerRole"" ", @WindowsDir, @SW_SHOW) c:\windows\sysnative is a folder which you cant browse too, but it does exist and the above command succeeded. I thank you all for your assistance with my problem, and while it wasnt an AutoIT issue I have learnt a little more about AutoIT throughout this excercise. Matt 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