Skip to content

Instantly share code, notes, and snippets.

@michaelbarkdoll
Last active December 7, 2015 18:09
Show Gist options
  • Save michaelbarkdoll/10c55822276a3f33f8ca to your computer and use it in GitHub Desktop.
Save michaelbarkdoll/10c55822276a3f33f8ca to your computer and use it in GitHub Desktop.
Set-ExecutionPolicy unrestricted -Force
$nlm = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$connections = $nlm.getnetworkconnections()
$connections |foreach {
if ($_.getnetwork().getcategory() -eq 0)
{
$_.getnetwork().setcategory(1)
}
}
### Enable-PSRemoting -SkipNetworkProfileCheck -Force
# Configure windows to accept winrm connection (Inside an Open an administrative powershell shell)
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow profile=any
netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow profile=any
net stop winrm
sc.exe config winrm start= auto
net start winrm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment