1. Who is logged on
#requires -version 4.0#use ConfigurationDataConfiguration MyConfig3 {Param()Import-DscResource -module xSMBShareImport-DscResource -ModuleName ComputerManagementDscNode $allNodes.nodename {#region FoldersFile Company {Ensure = "Present"DestinationPath = "c:\Company"Type = "Directory"}TimeZone Company {TimeZone = "Central Europe Standard Time"IsSingleInstance = "Yes"}xSMBShare Company {DependsOn = "[File]Company"Name = "Company$"Path = "C:\Company"Ensure = "Present"FolderEnumerationMode = "AccessBased"}#endregion} #close configuration}
2. Load configuration to memory
. .\Config-MyConfig3.ps1
Get-Command -CommandType Configuration
myconfig3 -ConfigurationData .\myconfig2data.psd1 -OutputPath C:\DSC\MyConfig2
#one MOF per server
psedit c:\dsc\myconfig2\WIN-3UTHK7V1J58.mof
3.Deploy and verify
$paramHash = @{
ComputerName = "WIN-3UTHK7V1J58"
Path = "C:\dsc\MyConfig2"
Wait = $True
verbose = $True
}
Start-DscConfiguration @paramHash
$paramHash = @{
Path = "C:\dsc\MyConfig2"
ComputerName = "chi-core01"
OutVariable = "j"
}
Start-DscConfiguration @paramHash
#receive-job results when it completes
wait-job $j
#receive-job XX -verbose -keep
$j | receive-job -keep -verbose
#view result
Get-DscConfiguration -CimSession chi-fp02
4.
No comments:
Post a Comment