[英]Powershell DSC: How to download and install MSI
使用Powershell DSC如何下載和安裝msi。 我到目前為止已看到的參考資料是此鏈接https://blogs.msdn.microsoft.com/brian_farnhill/2015/03/15/using-dsc-to-download-from-azure-file-storage-to-an- azure-vm / 。 但是我只能將共享文件夾用於http。
File DownloadWebPi
{
DestinationPath = $PSScriptRoot
Ensure ="Present"
SourcePath = "http://go.microsoft.com/fwlink/?LinkId=287166"
Type = "File"
}
Script DownloadMsi
{
GetScript =
{
@{
GetScript = $GetScript
SetScript = $SetScript
TestScript = $TestScript
Result = ('True' -in (Test-Path c:\Somepath\install.msi))
}
}
SetScript =
{
Invoke-WebRequest -Uri "http://go.microsoft.com/fwlink/?LinkId=287166" -OutFile "c:\Somepath\install.msi"
}
TestScript =
{
$Status = ('True' -in (Test-Path c:\Somepath\install.msi))
$Status -eq $True
}
}
然后接下來寫下一部分以安裝msi,這取決於本節。 也不要使用$PSScriptRoot
因為我相信這是在system32中執行的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.