Jump to content
Sign in to follow this  
XmangiaX

Problem getting ShellExecuteWait to run.

Recommended Posts

XmangiaX

Hi All! ;)

I am trying to install Google Chrome across my network. I do not like the functionality (or lack thereof) of installing applications via GPO's. So I want to create an .exe and drop it it my GPO instead.I have created a script that I think is pretty simple, but I keep getting an error.

If FileExists("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") Then
  exit
ENDIF
If FileExists("C:\Program Files\Google\Chrome\Application\chrome.exe") Then
  exit
ENDIF
SplashTextOn("Google Chrome Installation", "This PC is currently installing Google Chrome.  Please be patient.  Thank you.  Office of Information Technology", 500, 100, 5, 5, 4, "Gothic", 14)
BlockInput(1)

ShellExecuteWait("msiexec /i '\\DOMAINNAME\NETLOGON\Deployment\GoogleChrome\GoogleChromeStandaloneEnterprise.msi'")
BlockInput(0)
SplashOff()
exit

I get the Splash Screen to pop up then I get an error message When it tries to run my "ShellExecuteWait" statement.

Any help is appreciated. Thank you in advance

**Attached is a screenshot of error message**

post-10382-0-56601900-1338582248_thumb.j

Share this post


Link to post
Share on other sites
JLogan3o13

Hi, XmangiaX. The error is telling you what you've done wrong. In this line:

ShellExecuteWait("msiexec /i 'DOMAINNAMENETLOGONDeploymentGoogleChromeGoogleChromeStandaloneEnterprise.msi'")

First off, you need to separate the executable and the parameters with a comma, like this:

ShellExecuteWait("msiexec.exe",  '/i "DOMAINNAMENETLOGONDeploymentGoogleChromeGoogleChromeStandaloneEnterprise.msi"')

Secondly, it is telling you it cannot find DOMAINNAMENETLOGONetcetc. You have to put in a real path to your msi, not just DOMAINNAME. Try something like this:

ShellExecuteWait("msiexec.exe", '/i "<Name of your Server><Name of the Share>DeploymentGoogleChromeGoogleChromeStandaloneEnterprise.msi"')

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
XmangiaX

Hi JLogan.

Thanks for the super fast reply. I just ommited my domain name on purpose for some reason. I did not know about seperating with the comma I will go try this now.

Again thanks!

Share this post


Link to post
Share on other sites
XmangiaX

*Update*

I altered my script as you suggested and that got rid of the error. However I got a new error. It seems to think I dont have access to the file on the server share. And as you can see in my screenshot i can browse to the directory where the .msi resides.

post-10382-0-71775700-1338584404_thumb.j

Share this post


Link to post
Share on other sites
JLogan3o13

Can you show your updated code please? You can put in <mydomainname> for the first part of the path.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
XmangiaX

I've left work now. I will update tomorrow. Thanks

Share this post


Link to post
Share on other sites
XmangiaX

If FileExists("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") Then
  exit
ENDIF
If FileExists("C:\Program Files\Google\Chrome\Application\chrome.exe") Then
  exit
ENDIF
SplashTextOn("Google Chrome Installation", "This PC is currently installing Google Chrome.  Please be patient.  Thank you.  Office of Information Technology", 500, 100, 5, 5, 4, "Gothic", 14)
BlockInput(1)
ShellExecuteWait("msiexec.exe", '/i "\\cluster1\shared\Deployment\GoogleChromeStandaloneEnterprise.msi"')
BlockInput(0)
SplashOff()
exit

Edited by XmangiaX

Share this post


Link to post
Share on other sites
XmangiaX

I changed the deployment area from Netlogon to a server share. In my prior post you can see that the computer can navigate to the server share, but its telling me I dont have access.....

Thanks again for any assistance.

Share this post


Link to post
Share on other sites
AdmiralAlkex

*Update*

I altered my script as you suggested and that got rid of the error. However I got a new error. It seems to think I dont have access to the file on the server share. And as you can see in my screenshot i can browse to the directory where the .msi resides.

That looks like it could be a messagebox from the Windows Installer service, which runs under the LocalSystem user. Can it browse the folder too?

Share this post


Link to post
Share on other sites
XmangiaX

Will check this in a moment.

Share this post


Link to post
Share on other sites
XmangiaX

OK ive altered my script even more.... I copied the file to the root of C: now. Does "ShellExecuteWait" run on windows 7?

If FileExists("C:Program Files (x86)GoogleChromeApplicationchrome.exe") Then
  exit
ENDIF
If FileExists("C:Program FilesGoogleChromeApplicationchrome.exe") Then
  exit
ENDIF
SplashTextOn("Google Chrome Installation", "This PC is currently installing Google Chrome.  Please be patient.  Thank you.  Office of Information Technology", 500, 100, 5, 5, 4, "Gothic", 14)
BlockInput(1)
FileCopy("cluster1SHAREDDeploymentGoogleChromeGoogleChromeStandaloneEnterprise.msi", "c:")
ShellExecuteWait("msiexec.exe", '/i "C:GoogleChromeStandaloneEnterprise.msi"')
BlockInput(0)
SplashOff()
exit

Share this post


Link to post
Share on other sites
JLogan3o13

Yes ShellExecuteWait runs on Windows 7. Try this, and let us know if you see the MSI installing:

If FileExists(@ProgramFilesDir & "GoogleChromeApplicationchrome.exe") Then
   Exit
Else
   SplashTextOn("Google Chrome Installation", "This PC is currently installing Google Chrome.  Please be patient.  Thank you.  Office of Information Technology", 500, 100, 5, 5, 4, "Gothic", 14)
   BlockInput(1)
   FileCopy("cluster1SHAREDDeploymentGoogleChromeGoogleChromeStandaloneEnterprise.msi", "c:")
   ShellExecuteWait("msiexec.exe", '/i "C:GoogleChromeStandaloneEnterprise.msi" /qb')
   BlockInput(0)
   SplashOff()
EndIf
Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
BrewManNH

You could also do it this way:

ShellExecuteWait("C:GoogleChromeStandaloneEnterprise.msi" , "/qb")

Because ShellExecute uses the program assigned to the filetype automatically, there's no need to execute the msiexec program inside the command, just let Windows run the program assigned to running .msi files. Either way should work, but there's less typing when you don't put things in the command that are unnecessary. ;)


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
XmangiaX

@JLogan3of13

It is not installing..... I have a brand new Windows 7 machine I am testing on. It is on the network and in the group I assigned for the GPO to run the setup file I compiled. If I take the actual .exe file I made and run it on the machine it will work. When I make it a part of the Computer Configuration under PoliciesWindows SettingsScriptsStartup it will not run...

Share this post


Link to post
Share on other sites
JLogan3o13

Ok, if the file is running fine when you do it manually, it is not a problem with your script but with the GPO.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
BrewManNH

When you run it on the computer, not using GP, does it display any GUIs when it's run?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
XmangiaX

when i run the file locally on the computer I see my window with the message I created and a staus bar.... thats it.. then it unlocks the keyboard and I have Chrome installed. Why it wont run in a GPO is KILLING ME!!! ;)

Share this post


Link to post
Share on other sites
XmangiaX

THanks everyone for your help.. My script works perfectly now.. I know this isnt a place for MS help, so I will continue on my own now.

THis place is awesome by the way and I am sure I will be utilizing it more in the future... Thanks for all of your help to everyone who assisted me! ;)

Share this post


Link to post
Share on other sites
BrewManNH

Well, first of all, if you're running it from a GP at boot up, get rid of the splashscreen because no one is going to see it. Get rid of the BlockInput, because no one is able to interact with the computer at this point anyways so it's pointless. You don't need the /qb in the ShellExecute line, because you can't interact with the program while it's installing so use /qn which eliminates any user interface as well.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
JLogan3o13

Actually, I think BrewManNH may have hit the nail on the head. If I recall correctly from my MCSE days, applications deployed via GPO default to the SYSTEM account. If you put in things like Splash images and BlockInput, I don't think it will work correctly. I would suggest stripping everything but the MSI line itself and see if it deploys correctly. Then you can play around with re-adding your file check.


√-1 2^3 ∑ π, and it was delicious!

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  

×