3 заметки с тегом

ps

Fix на шаринг интернета при старте. Win2k16.

$m = New-Object -ComObject HNetCfg.HNetShare
$m.EnumEveryConnection |% { $m.NetConnectionProps.Invoke($_) }
$c1 = $m.EnumEveryConnection |? { $m.NetConnectionProps.Invoke($_).Name -eq "External" }
$c2 = $m.EnumEveryConnection |? { $m.NetConnectionProps.Invoke($_).Name -eq "Local" }
$config1 = $m.INetSharingConfigurationForINetConnection.Invoke($c1)
$config2 = $m.INetSharingConfigurationForINetConnection.Invoke($c2)
$config1.DisableSharing()
$config2.DisableSharing()
$config1.EnableSharing(0)
$config2.EnableSharing(1)

netsh interface ipv4 set address name="Local" static 10.79.197.1 255.255.255.0

Запускать:

powershell.exe -ExecutionPolicy Unrestricted -File c:\fix\sharereset.ps1
2018   ps
2018   ps
2018   1c   ps