Time to join a Windows 7 client to a domain. Now that the Test Domain is up and running ( Check Previous Posts ), we can start joining clients to the domain.
Since it’s a freshly installed Windows 7 client, we dont have to bother about userprofiles and so on.. we’ll save that for later
function JoinDomain ([string]$Domain, [string]$User, [string]$Password ) {
$DomainUser = $Domain + "\" + $User
$OU = $null
$ComputerSystem = gwmi Win32_ComputerSystem
$ComputerSystem.JoinDomainOrWorkGroup(
$Domain,
$Password,
$DomainUser,
$OU,
3
)
}
Here’s an example on running the function.
PS > JoinDomain PowerShell.nu migaccount Password1And voila! the client shuts down and on Startup, It’ll have joined the new domain.
[?]
