cLMHostLookup.psm1
[DSCResource(RunAsCredential = "NotSupported")] class cLMHostLookup { [DscProperty(Key)] [string]$InterfaceAlias [DscProperty(Mandatory)] [bool]$Enabled [void] Set() { ([wmiclass]'Win32_NetworkAdapterConfiguration').EnableWINS($($this.Enabled), $($this.Enabled)) } [cLMHostLookup] Get() { $Adapter = Get-WMIObject Win32_NetworkAdapter -Filter "NetConnectionID = '$($this.InterfaceAlias)'" $Result = [bool](Get-WMIObject Win32_NetworkAdapterConfiguration -Filter "Index = $($Adapter.Index)").WinsEnableLMHostsLookup $cLMHostLookup = [cLMHostLookup]::New() $cLMHostLookup.Enabled = $Result $cLMHostLookup.InterfaceAlias = $this.InterfaceAlias return $cLMHostLookup } [bool] Test() { return $this.Get().Enabled -eq $this.Enabled } } |