$compname = "20161"
$ip = "10.0.2.4"
#find a way to get the interfaceindex
$index = Get-NetAdapter | Select-Object -ExpandProperty ifIndex
#now set the ip of that index adapter
New-NetIPAddress -InterfaceIndex $index -IPAddress $ip -PrefixLength 16 -DefaultGateway 10.0.0.1
#now set the DNS for that index adapter
Set-DnsClientServerAddress -InterfaceIndex $index -ServerAddresses 10.0.3.190
$cred = Get-Credential -UserName domain\user -Message "Enter domain creds"
Add-Computer -DomainName ark.local -Credential $cred -NewName $compname -Restart