

Once the MOF is generated, we just need to start the DSC configuration process by running Start-DscConfiguration-Path C:\Install7Zip-Wait-Verbose. This will create a MOF file with the name of the local computer in the location of the output path. Once the configuration is built, we'll need to execute it like a simple PowerShell function. I'd like to confirm the software is present on the local machine, and I've filled in the values we collected earlier. Inside, I'm referencing the Package resource and calling it Install7Zip as well. You can see above that I have a user-defined configuration called Install7Zip and am pointing the install to the local computer name. Now that I have the proper name and product ID, I can create the DSC configuration script. Retrieving the application name and product ID Otherwise, you'll need to scour the HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall and HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall registry keys looking for the 7-Zip key. To do this, I'll use the Get-InstalledSoftware function in my SoftwareInstallManager module. Once installed, I'll note the name and productID it was installed with. This is an important step, as these attributes detect if the software is installed. Now that it's in place, I'll need to install the package once manually to gather a proper name and product ID for the configuration script. I've downloaded and placed the 7-Zip MSI package on my computer at C:\7z1514-圆4.msi. If you've got lots of servers to install software on, look into setting up DSC in "pull" mode. This is not a requirement, however, for the Package resource. I'll be installing 7-Zip on a single, local machine, so I'll need to check that the package exists on that machine. If it is available, you should see the Package resource properties.

Once you've confirmed a current version, the next step is to ensure the Package resource is available by running Get-DscResource.

You can always check this by typing $ into the console. First, you need to have PowerShell v4 or later installed.
