[英]Powershell script to install Azure Service Fabric SDK, runtime and tools silently
I'm trying to write a script to download an install Azure Service Fabric SDK, runtime and tools into a few servers. 我正在尝试编写脚本以将安装的Azure Service Fabric SDK,运行时和工具下载到一些服务器中。
My issue is that the installer provided here is a Web Installer, and does not support silent mode. 我的问题是, 此处提供的安装程序是Web Installer,并且不支持静默模式。
I found a guy that solved this issue here . 我在这里找到了一个可以解决此问题的人。 His code: 他的代码:
# Install Service Fabric Runtime
Invoke-WebRequest "http://download.microsoft.com/download/3/2/1/3217654F-6882-4CEA-BD51-49287EDECE9B/MicrosoftServiceFabric.6.0.232.9494.exe" -OutFile "C:\ServiceFabricRuntime.exe" -UseBasicParsing; \
Start-Process "C:\ServiceFabricRuntime.exe" -ArgumentList '/AcceptEULA', '/QUIET' -NoNewWindow -Wait; \
rm "C:\ServiceFabricRuntime.exe"
# Install Service Fabric SDK
Invoke-WebRequest "http://download.microsoft.com/download/3/2/1/3217654F-6882-4CEA-BD51-49287EDECE9B/MicrosoftServiceFabricSDK.2.8.232.msi" -OutFile "C:\ServiceFabricSDK.msi" -UseBasicParsing; \
Start-Process "msiexec" -ArgumentList '/i', 'C:\ServiceFabricSDK.msi', '/passive', '/quiet', '/norestart', '/qn' -NoNewWindow -Wait; \
rm "C:\ServiceFabricSDK.msi"
As you can see, he's using direct links to the .msi installers (as well as other guys are doing in other threads like these two answers.). 如您所见,他正在使用指向.msi安装程序的直接链接(以及其他人在其他线程中所做的工作,例如这 两个答案)。
So my questions is, how do i get a direct link to the msi with the latest version of these installers? 因此,我的问题是,如何获得这些安装程序的最新版本与msi的直接链接?
And the follow up question would be, is there a universal link that will automatically download the latest version of these tools? 接下来的问题是,是否有一个通用链接可以自动下载这些工具的最新版本?
Thanks in advance. 提前致谢。
I know this is not exactly what you asked for but you can use Web Platform Installer Command Line
to install WebPI
products silently. 我知道这并不是您所要求的,但是您可以使用Web Platform Installer Command Line
来静默安装WebPI
产品。 The idea is to download WebPICMD
and run installation of Service Fabric SDK
from the cmd line. 这个想法是下载WebPICMD
并从cmd行运行Service Fabric SDK
安装。 The powershell script can look like this: powershell脚本如下所示:
Invoke-WebRequest "https://download.microsoft.com/download/C/F/F/CFF3A0B8-99D4-41A2-AE1A-496C08BEB904/WebPlatformInstaller_amd64_en-US.msi" -OutFile "C:\WebPlatformInstaller.msi" -UseBasicParsing;
Start-Process "msiexec" -ArgumentList '/i', 'C:\WebPlatformInstaller.msi', '/passive', '/quiet', '/norestart', '/qn' -NoNewWindow -Wait;
rm "C:\WebPlatformInstaller.msi"
WebPICMD.exe /Install /Products:MicrosoftAzure-ServiceFabric-CoreSDK /AcceptEULA
Product MicrosoftAzure-ServiceFabric-CoreSDK
will install latest version of Service Fabric SDK
and Service Fabric Runtime
silently. 产品MicrosoftAzure-ServiceFabric-CoreSDK
将以MicrosoftAzure-ServiceFabric-CoreSDK
方式安装最新版本的Service Fabric SDK
和Service Fabric Runtime
。
If you want to install something different from the WebPI
run : 如果要安装不同于WebPI
运行:
WebPICMD.exe /List /ListOption:All
This command will list all of the available products, just grab the id of the product and run install command. 该命令将列出所有可用的产品,仅获取产品的ID并运行install命令。
To add on the answer above, if WebPlatformCMD gives you Windows' UAC consent window issues, you can use PSEXEC tools to run the installer as system account, avoiding that problem. 要补充上面的答案,如果WebPlatformCMD给您Windows的UAC同意窗口问题,则可以使用PSEXEC工具作为系统帐户运行安装程序,从而避免了该问题。
Example code: 示例代码:
Invoke-WebRequest "https://go.microsoft.com/fwlink/?LinkId=287166" -OutFile "$env:temp\WebPlatformInstaller_amd64_en-US.msi" -UseBasicParsing
Start-Process "msiexec" -ArgumentList "/i $env:temp\WebPlatformInstaller_amd64_en-US.msi /passive /quiet /norestart /qn" -NoNewWindow -Wait
$psToolsPath = "$env:temp\pstools"
New-Item $psToolsPath -ItemType directory -force -erroraction silentlycontinue
Invoke-WebRequest -Uri https://download.sysinternals.com/files/PSTools.zip -OutFile $psToolsPath\PSTools.zip
Expand-Archive "$psToolsPath\PSTools.zip" $psToolsPath -force
cd $psToolsPath
Start-Process psexec64 -ArgumentList "-s /accepteula WebPICMD.exe /Install /Products:MicrosoftAzure-ServiceFabric-CoreSDK /AcceptEULA"
Small note on SteppingRazor's answer above. 关于上述SteppingRazor答案的小注释。
You can ease out the ArgumentList Parameter value like this: 您可以像这样简化ArgumentList参数值:
Start-Process "msiexec" -ArgumentList "/i C:\WebPlatformInstaller.msi /passive /quiet /norestart /qn -NoNewWindow -Wait
Instead of 代替
Start-Process "msiexec" -ArgumentList '/i', 'C:\WebPlatformInstaller.msi', '/passive', '/quiet', '/norestart', '/qn' -NoNewWindow -Wait;
Then using variables in the string is also easier. 然后在字符串中使用变量也更容易。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.