February 2019
Intermediate to advanced
626 pages
15h 51m
English
The complete class, ComputerDescription, incorporating each of the preceding methods, is shown here:
enum Ensure { Absent Present}[DscResource()]class ComputerDescription { [DscProperty(Key)] [Ensure]$Ensure [DscProperty()] [String]$Description Hidden [String] $path = 'HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters' Hidden [String] $valueName = 'svrcomment' [ComputerDescription] Get() { $key = Get-Item $this.Path if ($key.GetValueNames() -contains $this.valueName) { $this.Ensure = 'Present' $this.Description = $key.GetValue($this.valueName) } else { $this.Ensure = 'Absent' } return $this } [Void] Set() { $params = @{ Path = $this.path Name = $this.valueName } if ($this.Ensure -eq 'Present') { New-ItemProperty ...Read now
Unlock full access