简体   繁体   中英

PowerShell DSC. Download and install software

Is it possible to download some software from internet, then install it on some of my servers using DSC? Chrome, for example? All DSC tutorials are pretty hard to understand (at least for me). I just want to see a simple example, similar to my use case, please.

Yes it is possible to use DSC to do what you desire. Here is an example of using Chocolatey community resource to install Chrome https://github.com/PowerShellOrg/cChoco/blob/master/ExampleConfig.ps1

You can also use DSC to install a package from the internet via a URL without Chocolatey. To do so, you need the exact name the product will be installed as and its ProductId value. The easiest way to get these is to install the software somewhere manually once first, then find these values via this PowerShell command:

Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, Version

Then you can install the software via DSC by using via the Package resource. Here's an example of doing so with the Local Administrator Password Solution tool from Microsoft:

Package 'LAPS' {
    Name      = 'Local Administrator Password Solution'
    Path      = 'https://download.microsoft.com/download/C/7/A/C7AAD914-A8A6-4904-88A1-29E657445D03/LAPS.x64.msi'
    ProductId = 'EA8CB806-C109-4700-96B4-F1F268E5036C'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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