#DevMachineConfig.ps1 Configuration DevMachineConfig { Import-DscResource -ModuleName PSDesiredStateConfiguration Node localhost { File TempDirectory { DestinationPath = "C:\Temp" Ensure = "Present" Type = "Directory" } Service WindowsInstaller { Name = "msiserver" State = "Running" } } } DevMachineConfig
.\DevMachineConfig.ps1
It will create a folder with the same name as the configuration.
Inside there will be of files for each and every node, present there will be only localhost.mof
If you open it, you can see the configuration written below.
localhost.mof /* @TargetNode='localhost' @GeneratedBy=Administrator @GenerationDate=08/04/2020 10:49:50 @GenerationHost=TEST_UDAY */ instance of MSFT_FileDirectoryConfiguration as $MSFT_FileDirectoryConfiguration1ref { ResourceID = "[File]TempDirectory"; Type = "Directory"; Ensure = "Present"; DestinationPath = "C:\\Temp"; ModuleName = "PSDesiredStateConfiguration"; SourceInfo = "C:\\Users\\Administrator\\Desktop\\dsc\\DevMachineConfig.ps1::7::3::File"; ModuleVersion = "1.0"; ConfigurationName = "DevMachineConfig"; }; instance of MSFT_ServiceResource as $MSFT_ServiceResource1ref { ResourceID = "[Service]WindowsInstaller"; State = "Running"; SourceInfo = "C:\\Users\\Administrator\\Desktop\\dsc\\DevMachineConfig.ps1::14::3::Service"; Name = "msiserver"; ModuleName = "PSDesiredStateConfiguration"; ModuleVersion = "1.0"; ConfigurationName = "DevMachineConfig"; }; instance of OMI_ConfigurationDocument { Version="2.0.0"; MinimumCompatibleVersion = "1.0.0"; CompatibleVersionAdditionalProperties= {"Omi_BaseResource:ConfigurationName"}; Author="Administrator"; GenerationDate="08/04/2020 10:49:50"; GenerationHost="TEST_UDAY"; Name="DevMachineConfig"; };
Now, you need to apply the configuration as below.
Start-DscConfiguration -Path .\DevMachineConfig\ -Wait -Verbose
No comments:
Post a Comment