/build/static/layout/Breadcrumb_cap_w.png

Microsoft Dynamics vbs install script

Hi I'm trying to get vbs script working to install Microsoft Dynamics 2009 on some of our servers. The script needs to pass the paramters of the setup.exe (only way the app installs) and also delete some shortcuts from the desktop. The problem i have is that install paths are not recognised by the setup.exe inside the vbs due to the " in the path statement. However if i dont use " in my install path the vbs fails with syntax errors. I'm wondering if anyone can help. I know a possibilty could be using a variable for the path, but i'm a bit of vbs newbie, and not quite sure how to script that.

 

WshShell.Run "change user /install",0,True

'Install App

Dim WSHShell
Set WSHShell = WScript.CreateObject ("WSCript.shell")
WSHShell.Run "change user /install",0,True
WSHShell.Run Chr(34) & "\\Installserver\DynamicsAX2009\setup.exe" & chr(34) & " SETUPLANGUAGE=EN " & "ConfigurePrerequisites=1 " & "HideUI=1 " & "AcceptLicenseTerms=1 "  & "InstallPath= " & chr(34) & "C:\PROGRAM FILES\Microsoft Dynamics AX\50 " & "InstallPath32Bit " & chr(34) & "C:\Program Files (x86)\Microsoft Dynamics AX\50 " & "InstallClientUI=1 " & "ClientAosServer=DynamicxAx-Standard@AppDynamicsAX:2712 " & "ClientLanguage=en-nz " & "ClientHelpLanguages=en-US;en-nz " & "LogDir=C:\Logs\AX2009.Install.log" & Chr(34), 1, True
WScript.sleep(7000)

' Delete application icons from start menu

Set objFSO = CreateObject("Scripting.FileSystemObject")
If ObjFSO.FolderExists("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Dynamics AX 2009") Then
 ObjFSO.DeleteFolder("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Dynamics AX 2009"), True
End If

 


0 Comments   [ + ] Show comments

Answers (5)

Posted by: jagadeish 11 years ago
Red Belt
2

The below code should work..

WSHShell.Run Chr(34) & "\\Installserver\DynamicsAX2009\setup.exe" & chr(34) & " SETUPLANGUAGE=EN ConfigurePrerequisites=1 HideUI=1 AcceptLicenseTerms=1 InstallPath=" & chr(34) & "C:\PROGRAM FILES\Microsoft Dynamics AX\50" & Chr(34) & " InstallPath32Bit=" & chr(34) & "C:\Program Files (x86)\Microsoft Dynamics AX\50"& Chr(34) & " InstallClientUI=1 ClientAosServer=DynamicxAx-Standard@AppDynamicsAX:2712 ClientLanguage=en-nz ClientHelpLanguages=en-US;en-nz LogDir=" & Chr(34) & "C:\Logs\AX2009.Install.log" & Chr(34)

 

Posted by: asman 11 years ago
Purple Belt
1

Installer = chr(34) & "\\Installserver\DynamicsAX2009\setup.exe" & chr(34)
Switches = " SETUPLANGUAGE=EN " & "ConfigurePrerequisites=1 " & "HideUI=1 " & "AcceptLicenseTerms=1 "  & "InstallPath= " & chr(34) & "C:\PROGRAM FILES\Microsoft Dynamics AX\50 " & "InstallPath32Bit " & chr(34) & "C:\Program Files (x86)\Microsoft Dynamics AX\50 " & "InstallClientUI=1 " & "ClientAosServer=DynamicxAx-Standard@AppDynamicsAX:2712 " & "ClientLanguage=en-nz " & "ClientHelpLanguages=en-US;en-nz " & "LogDir=C:\Logs\AX2009.Install.log" & Chr(34)

Check = Installer & Switches

Wscript.Echo "my complete installation looks like this: " & Check

Install = WshShell.Run(Check, 1, True)
If Install <> 0 Then
 Wscript.Echo "fail"
End if


Comments:
  • It's a bit messy so check your {space} and chr(34)....but the point is that u'll see the complete installationstring, and were it goes wrong - asman 11 years ago
Posted by: djjass 11 years ago
Senior Purple Belt
1

Looks like the Dynamics setup.exe wrapper gets confused with spaces in the install path. I managed to get around this by running a cmd file that calls the install string, and then running a vbs inside the cmd to delete the icons i places as part of the install. Not the best work but does the job.

Posted by: djjass 11 years ago
Senior Purple Belt
0

Fixed the script and included a sub routine to get by the Open File security window when launching a vbs. Works great. Hope it helps someone out there. I basically launch a secondary cmd from inside the vbs.

'---------------------------------------------------------------------
'Start Script
'---------------------------------------------------------------------
OnErrorResumeNext

'Enter install mode
WshShell.Run"change user /install",0,True

'Install App

Dim WSHShell
Set WSHShell = WScript.CreateObject ("WSCript.shell")
set oEnv = oShell.Environment("PROCESS")


set objShell = CreateObject("Wscript.shell")

Set objEnv = objShell.Environment("PROCESS")

'*********************************************************************************

'Main Routine

'*********************************************************************************

objEnv("SEE_MASK_NOZONECHECKS") = 1

Install_Application()

objEnv.Remove("SEE_MASK_NOZONECHECKS")

'*********************************************************************************

'Install Application

'*********************************************************************************

Function Install_Application()

'setup program

objShell.run"cmd /c \\installServer\AppsBuild\DynamicsAX2009\setup.exe SETUPLANGUAGE=EN ConfigurePrerequisites=1 HideUI=1 AcceptLicenseTerms=1 InstallPath=""C:\Program Files\Microsoft Dynamics AX\50"" InstallPath32Bit=""C:\Program Files(x86)\Microsoft Dynamics AX\50"" InstallClientUI=1 ClientConfig=1 ClientAosServer=DynamicxAx-Standard@AppDynamicsAX:2712 ClientLanguage=en-nz ClientHelpLanguages=en-US;en-nz LogDir=C:\CSR_Logs\AX2009.Install.log", 1, True
WScript.Sleep(7000)

EndFunction

' Delete application icons from start menu

Set objFSO = CreateObject("Scripting.FileSystemObject")
If ObjFSO.FolderExists("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Dynamics AX 2009") Then
    ObjFSO.DeleteFolder("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Dynamics AX 2009"), True
EndIf

' End Script

 

Posted by: M P 11 years ago
Purple Belt
0

Give this a shot and see if it works.  I removed the miscellaneous Chr's and removed the combining operators to create a better looking string.  The only thing that was really necessary was double-quoting the multiple "Install Path" references.  Check out http://technet.microsoft.com/en-us/library/aa548130.aspx for command-line parameter help with the installer.  A few of the switches I see in your command do not exist on the web page.

WshShell.Run "change user /install", 0, True

' Install App

Dim WSHShell
Set WSHShell = WScript.CreateObject ("WSCript.shell")
WSHShell.Run "change user /install", 0, True
WSHShell.Run "\\Installserver\DynamicsAX2009\setup.exe SETUPLANGUAGE=EN ConfigurePrerequisites=1 HideUI=1 AcceptLicenseTerms=1 InstallPath=""C:\PROGRAM FILES\Microsoft Dynamics AX\50"" InstallPath32Bit=""C:\Program Files (x86)\Microsoft Dynamics AX\50"" InstallClientUI=1 ClientAosServer=DynamicxAx-Standard@AppDynamicsAX:2712 ClientLanguage=en-nz ClientHelpLanguages=en-US;en-nz LogDir=C:\Logs\AX2009.Install.log", 1, True
WScript.sleep(7000)

' Delete application icons from start menu

Set objFSO = CreateObject("Scripting.FileSystemObject")
If ObjFSO.FolderExists("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Dynamics AX 2009") Then
 ObjFSO.DeleteFolder("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Dynamics AX 2009", True)
End If

 
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