$domain = "smb01" $pass = "Titok12345" | ConvertTo-SecureString -asPlainText -Force $user = "$domain\administrator" $credential = New-Object System.Management.Automation.PSCredential($user,$pass) Add-Computer -DomainName $domain -Credential $credential
Aláírás nélküli PowerShell script futtatásának engedélyezése:
Set-ExecutionPolicy RemoteSigned
Futtatás PowerShellben:
.\joinDomain.ps1
cmd-ben:
PowerShell -File joinDomain.ps1
$domain = "smb01" $pass = "Titok12345" | ConvertTo-SecureString -asPlainText -Force $user = "$domain\administrator" $credential = New-Object System.Management.Automation.PSCredential($user,$pass) Remove-computer -Credential $credential