u123
u123

Reputation: 16329

DSC does not install Git

I am trying to use DSC to install Git on Windows 7 using PowerShell 4.0 based on:

https://justingalston.wordpress.com/2014/06/11/using-powershell-desired-state-configuration-to-check-for-and-install-applications/

Configuration InstallApps
{

  Node localhost
  {
    Package Git
    {
        Ensure = "Present"
        Name = "Git"
        Path = "C:\tmp\Git-2.7.0.2-64-bit.exe"
        ProductId = ''
    }
  }
}
InstallApps

Git is not installed on the machine where I am running the above script from.

When I run the above git is not installed instead a localhost.mof file is created in the folder InstallApps:

Mode                LastWriteTime     Length Name                                                                      
----                -------------     ------ ----                                                                      
-a---        05-02-2016     11:35       1292 localhost.mof                                                             


[Finished in 2.4s]

Why is the installation not triggered?

Upvotes: 1

Views: 617

Answers (1)

Alexis Coles
Alexis Coles

Reputation: 1317

I have not read the blog you reference, however running the above function just creates the mof file.

In order to run the mof file and perform the desired state you need to run the Start-DscConfiguration cmdlet. Something like the following...

Start-DscConfiguration -ComputerName TargetMachine -Path GeneratedMofFileLocation -Wait -Verbose

Upvotes: 1

Related Questions