network configuration recipes
See also: all the recipes and the intro
See also how to configure CredSSP with PowerShell.
# DHCP server
In a VM must use the Legacy adapter, or it would refuse to get a static
address, and DHCP will refuse to attach to interfaces with dynamic address.
# how to shut up the DHCP authorization
reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\DHCPServer\Parameters /v DisableRogueDetection /t REG_DWORD /d 1
# and reboot afterwards
# DNS Server
If configuring itself as a server, configure a remote zone for ipv6 ::1
(localhost). Otherwise dhclient will hiccup for 2 seconds when trying to
resolve the localhost DNS server address.
# instructions how to diagnose WinRM
https://blogs.msdn.microsoft.com/wmi/2010/03/16/collecting-winrm-traces/
# Get the configuration
winrm get winrm/config
# Do the general basic setup
winrm quickconfig
# same with PowerShell, allowing for even a public network
Enble-PSRemoting –force –SkipNetworkProfileCheck
# The setup for HTTPS works only if the machine has a proper certificate
winrm quickconfig -transport:https
# Enable the basic authentication - not really needed
winrm set winrm/config/client/auth @{Basic="true"}
winrm set winrm/config/client/auth '@{Basic="true"}' # in PS
# enable non-SSL communication on the client
winrm set winrm/config/client @{AllowUnencrypted="true"}
winrm set winrm/config/client '@{AllowUnencrypted="true"}' # in PS
# same in PowerShell
Set-Item -Force WSMan:\localhost\Client\AllowUnencrypted true
# Adding a computer to trusted hosts, needed for non-SSL connection to
# machines by IP
winrm s winrm/config/client @{TrustedHosts="RemoteComputer"}
winrm s winrm/config/client '@{TrustedHosts="RemoteComputer"}' # in PS
# same in PowerShell
Set-Item -Force WSMan:\localhost\Client\TrustedHosts *
winrm s winrm/config/client @{TrustedHosts="169.254.81.127"}
# check connection
winrm identify -r:169.254.81.127 -u:administrator -p:password
# Make a share in PS
$sh = New-SmbShare -Name Test -Path c:\tmp\xxx -ReadAccess Everyone
# HTTP server API
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364510%28v=vs.85%29.aspx