Powershell: Rename PC and Add to Domain

Rename-Computer -Restart -NewName NameHere1234

$cred=Get-Credential
Add-Computer -DomainName domain.local -Credential $cred