$domainAdminCred = Credential
$localAdminCred = Credential
$ScriptBlock = {
param($domainAdminCred, $computer)
$domain = "Domain"
Write-Host "[processing '$computer' ...]"
Add-Computer -DomainName $domain -Credential $domainAdminCred -OUPath "OU=group1,DC=testing,DC=com" -Restart -Force
}
$IP = "192.168.1.101"
$computer = "PC-01"
Invoke-Command $IP -ScriptBlock $ScriptBlock -ArgumentList $domainAdminCred, $computer -Credential $localAdminCred
$IP = "192.168.1.102"
$computer = "PC-02"
Invoke-Command $IP -ScriptBlock $ScriptBlock -ArgumentList $domainAdminCred, $computer -Credential $localAdminCred
Wednesday, September 10, 2014
PowerShell - Remote Add/Join Computers to domain
Labels:
PowerShell,
Windows 7
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment