Skip to content

Instantly share code, notes, and snippets.

@niclaslindstedt
Last active October 27, 2018 10:37
Show Gist options
  • Save niclaslindstedt/212a3b0693422724f8084db185a5b634 to your computer and use it in GitHub Desktop.
Save niclaslindstedt/212a3b0693422724f8084db185a5b634 to your computer and use it in GitHub Desktop.
Useful PowerShell commands
# Set IP-address
New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress "192.168.1.200" -AddressFamily IPv4 -PrefixLength 24 -DefaultGateway 192.168.1.1
# Set DNS server
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 1.1.1.1,1.0.0.1
# Allow remote connections
Set-Item WSMAN:\localhost\Client\TrustedHosts -value RemoteComputerName -force
# Create AD forest
Install-ADDSForest -CreateDnsDelegation:$false -DatabasePath "C:\Windows\NTDS" -DomainMode "Win2012" -DomainName <DOMAINNAME> -DomainNetbiosName <NETBIOSNAME> -ForestMode "Win2012" -InstallDns:$true -LogPath "C:\Windows\NTDS" -NoRebootOnCompletion:$false -SysvolPath "C:\Windows\SYSVOL" -Force:$true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment