-
Notifications
You must be signed in to change notification settings - Fork 82
Computer
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
| Name | Key | String | The desired computer name. | |
| DomainName | Write | String | The name of the domain to join. | |
| JoinOU | Write | String | The distinguished name of the organizational unit that the computer account will be created in. | |
| Credential | Write | PSCredential | Credential to be used to join a domain. | |
| UnjoinCredential | Write | PSCredential | Credential to be used to leave a domain. | |
| WorkGroupName | Write | String | The name of the workgroup. | |
| Description | Write | String | The value assigned here will be set as the local computer description. | |
| Server | Write | String | The Active Directory Domain Controller to use to join the domain | |
| CurrentOU | Read | String | A read-only property that specifies the organizational unit that the computer account is currently in. |
The resource allows you to configure a computer by changing its name and description and modifying its Active Directory domain or workgroup membership.
This configuration will set the computer name to 'Server01' and make it part of 'ContosoWorkgroup' Workgroup.
Configuration Example
{
param
(
[Parameter()]
[System.String[]]
$NodeName = 'localhost'
)
Import-DscResource -Module ComputerManagementDsc
Node $NodeName
{
Computer NewNameAndWorkgroup
{
Name = 'Server01'
WorkGroupName = 'ContosoWorkgroup'
}
}
}This configuration sets the machine name to 'Server01' and joins the 'Contoso' domain. Note: this requires an AD credential to join the domain.
Configuration Example
{
param
(
[Parameter()]
[System.String[]]
$NodeName = 'localhost',
[Parameter(Mandatory = $true)]
[ValidateNotNullorEmpty()]
[System.Management.Automation.PSCredential]
$Credential
)
Import-DscResource -Module ComputerManagementDsc
Node $NodeName
{
Computer JoinDomain
{
Name = 'Server01'
DomainName = 'Contoso'
Credential = $Credential # Credential to join to domain
}
}
}This example will change the machines name 'Server01' while remaining joined to the current domain. Note: this requires a credential for renaming the machine on the domain.
Configuration Example
{
param
(
[Parameter()]
[System.String[]]
$NodeName = 'localhost',
[Parameter(Mandatory = $true)]
[ValidateNotNullorEmpty()]
[System.Management.Automation.PSCredential]
$Credential
)
Import-DscResource -Module ComputerManagementDsc
Node $NodeName
{
Computer NewName
{
Name = 'Server01'
Credential = $Credential # Domain credential
}
}
}This example will set the machine name to 'Server01' while remaining in the workgroup.
Configuration Example
{
param
(
[Parameter()]
[System.String[]]
$NodeName = 'localhost'
)
Import-DscResource -Module ComputerManagementDsc
Node $NodeName
{
Computer NewName
{
Name = 'Server01'
}
}
}This example switches the computer 'Server01' from a domain and joins it to the 'ContosoWorkgroup' Workgroup. Note: this requires a credential.
Configuration Example
{
param
(
[Parameter()]
[System.String[]]
$NodeName = 'localhost',
[Parameter(Mandatory = $true)]
[ValidateNotNullorEmpty()]
[System.Management.Automation.PSCredential]
$Credential
)
Import-DscResource -Module ComputerManagementDsc
Node $NodeName
{
Computer JoinWorkgroup
{
Name = 'Server01'
WorkGroupName = 'ContosoWorkgroup'
Credential = $Credential # Credential to unjoin from domain
}
}
}This example will set the computer description
Configuration Example
{
param
(
[Parameter()]
[System.String[]]
$NodeName = 'localhost'
)
Import-DscResource -Module ComputerManagementDsc
Node $NodeName
{
Computer NewDescription
{
Name = 'localhost'
Description = 'This is my computer.'
}
}
}This configuration sets the machine name to 'Server01' and joins the 'Contoso' domain using the domain controller 'dc1.contoso.com'. Note: this requires an AD credential to join the domain.
Configuration Example
{
param
(
[Parameter()]
[System.String[]]
$NodeName = 'localhost',
[Parameter(Mandatory = $true)]
[ValidateNotNullorEmpty()]
[System.Management.Automation.PSCredential]
$Credential
)
Import-DscResource -Module ComputerManagementDsc
Node $NodeName
{
Computer JoinDomain
{
Name = 'Server01'
DomainName = 'Contoso'
Credential = $Credential # Credential to join to domain
Server = 'dc1.contoso.com'
}
}
}- Computer
- IEEnhancedSecurityConfiguration
- OfflineDomainJoin
- PendingReboot
- PowerPlan
- PowerShellExecutionPolicy
- PSResourceRepository
- RemoteDesktopAdmin
- ScheduledTask
- SmbServerConfiguration
- SmbShare
- SystemLocale
- SystemProtection
- SystemRestorePoint
- TimeZone
- UserAccountControl
- VirtualMemory
- WindowsCapability
- WindowsEventLog