简体   繁体   English

Powershell DSC:如何下载和安装MSI

[英]Powershell DSC: How to download and install MSI

Using Powershell DSC how do I download and install msi. 使用Powershell DSC如何下载和安装msi。 I the references I have seen so far this link https://blogs.msdn.microsoft.com/brian_farnhill/2015/03/15/using-dsc-to-download-from-azure-file-storage-to-an-azure-vm/ . 我到目前为止已看到的参考资料是此链接https://blogs.msdn.microsoft.com/brian_farnhill/2015/03/15/using-dsc-to-download-from-azure-file-storage-to-an- azure-vm / But I can only be used for shared folder no to http. 但是我只能将共享文件夹用于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
            }
        }

And then next write next part to install msi which depends on this section. 然后接下来写下一部分以安装msi,这取决于本节。 Also don't use $PSScriptRoot as I believe this executes in system32. 也不要使用$PSScriptRoot因为我相信这是在system32中执行的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM