Skip to content

Instantly share code, notes, and snippets.

@techthoughts2
Last active April 30, 2017 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techthoughts2/483f43010c8b46b2c19db8f475b10f7b to your computer and use it in GitHub Desktop.
Save techthoughts2/483f43010c8b46b2c19db8f475b10f7b to your computer and use it in GitHub Desktop.
Basic Configuration of a device. Assign IP to adapter, set DNS ip and gateway, rename, and join to a domain
$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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment