Skip to content

Commit 57c297b

Browse files
authored
Merge pull request #3 from gesbeckj/xDescription
Updates Based on Feedback including Naming Parameters, Expanding out MockWith, Changing Double Quotes to Single Quotes and adding descriptions to the schema
2 parents 7fd91f0 + f58fa36 commit 57c297b

4 files changed

Lines changed: 329 additions & 140 deletions

File tree

DSCResources/MSFT_xComputer/MSFT_xComputer.psm1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ function Set-TargetResource
117117
$Name = $env:COMPUTERNAME
118118
}
119119

120-
Write-Verbose -message "Setting description to '$($Description)'."
121-
$Win32_OperatingSystem = Get-CimInstance -ClassName Win32_OperatingSystem
122-
$Win32_OperatingSystem.Description = $Description
123-
Set-CimInstance -InputObject $Win32_OperatingSystem
120+
Write-Verbose -Message "Setting computer description to '$($Description)'."
121+
$win32OperatingSystemCimInstance = Get-CimInstance -ClassName Win32_OperatingSystem
122+
$win32OperatingSystemCimInstance.Description = $Description
123+
Set-CimInstance -InputObject $win32OperatingSystemCimInstance
124124

125125
if ($Credential)
126126
{
@@ -304,6 +304,7 @@ function Test-TargetResource
304304
}
305305

306306
Write-Verbose -Message 'Checking if description is corerect'
307+
307308
if ($Description -ne (Get-CimInstance -Class 'Win32_OperatingSystem').Description)
308309
{
309310
return $false
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[ClassVersion("1.0.1.0"), FriendlyName("xComputer")]
22
class MSFT_xComputer : OMI_BaseResource
33
{
4-
[key] string Name;
5-
[write] string DomainName;
6-
[write] string JoinOU;
7-
[read] string CurrentOU;
8-
[write,EmbeddedInstance("MSFT_Credential")] String Credential;
9-
[write,EmbeddedInstance("MSFT_Credential")] String UnjoinCredential;
10-
[write] string WorkGroupName;
11-
[write] string Description;
4+
[key, Description("The desired computer name")] string Name;
5+
[write, Description("The name of the domain to join")] string DomainName;
6+
[write, Description("The distinguished name of the organizational unit that the computer account will be created in")] string JoinOU;
7+
[read, Description("A read-only property that specifies the organizational unit that the computer account is currently in")] string CurrentOU;
8+
[write, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to join or leave domain")] String Credential;
9+
[write, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to join or leave domain")] String UnjoinCredential;
10+
[write, Description("The name of the workgroup")] string WorkGroupName;
11+
[Write, Description("The value assigned here will be set as the local computer description")] String Description;
1212
};

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ xComputer resource has following properties:
5353
* Credential: Credential to be used to join or leave domain
5454
* CurrentOU: A read-only property that specifies the organizational unit that
5555
the computer account is currently in
56-
* Description: The value assigned here will be as the local computer description
56+
* Description: The value assigned here will be set as the local computer description
5757

5858
### xComputer Examples
5959

0 commit comments

Comments
 (0)