Useful PowerShell commands
These are the PowerShell commands I frequently use when deploying a new Windows server.
#Enable Ping
Set-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request – ICMPv4-In)" -enabled True

#Get InterfaceIndex value
Get-NetAdapter -Name * | Format-Table –AutoSize

#Configure static IP - Use the InterfaceIndex value from the command above.
New-NetIPAddress –InterfaceIndex 5 –IPAddress 192.168.1.6 -PrefixLength 24 -DefaultGateway 192.168.1.1

#Configure DNS - Again, use the same InterfaceIndex value as above
Set-DnsClientServerAddress -InterfaceIndex 6 -ServerAddresses ("192.168.1.2","192.168.1.3")

#Check IP address settings
Get-NetIPConfiguration

#Rename computer and join domain
Add-Computer -Credential Admin-Username -DomainName dccb.net -NewName Server-001; Restart-Computer -force

#Empty recycle bin
Clear-RecycleBin -DriveLetter C -Force

#Find computer name
$env:computername
#OR
hostname.exe