powershell - AWS EC2 Install Chrome as user data -


i trying automate installation of chrome along few other other tasks using powershell in user data. installation of chrome fails, because needs powershell in elevated mode.

following snippet of code:

<powershell> #change timezone c:\windows\system32\tzutil /s "aus eastern standard time"  #install chrome  $path = $env:temp; $installer = "chrome_installer.exe"; invoke-webrequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -outfile     $path\$installer;  start-process -filepath $path\$installer -argumentlist "/silent /install" -verb runas -wait; remove-item $path\$installer  #set chrome default browser $chromepath = "${env:programfiles(x86)}\google\chrome\application\"  $chromeapp = "chrome.exe" $chromecommandargs = "--make-default-browser" & "$chromepath$chromeapp" $chromecommandargs </powershell> 

can please advise, how can achieved?

thanks in advance.

i able fix script adding "set-location "c:\windows\system32" first line. script looks below:

<powershell> set-location "c:\windows\system32"  #change timezone c:\windows\system32\tzutil /s "aus eastern standard time"  #install chrome  $path = $env:temp; $installer = "chrome_installer.exe"; invoke-webrequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -outfile     $path\$installer;  start-process -filepath $path\$installer -argumentlist "/silent /install" -verb runas -wait; remove-item $path\$installer  #set chrome default browser $chromepath = "${env:programfiles(x86)}\google\chrome\application\"  $chromeapp = "chrome.exe" $chromecommandargs = "--make-default-browser" & "$chromepath$chromeapp" $chromecommandargs </powershell> 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -