請問企業為內部區域網路環境,WIN7~WIN10系統,不知道在作業系統裡能不能設定為當USER偷偷使用4G上網使,就無法連到區域網路?
現在WIN10系統4G上網同時內部區域網路還是可以正常連線~
以下請先測試後,再決定是否使用
假設內網 IP 區段為 10.10.10.*
disable.ps1
# Log: Microsoft-Windows-NetworkProfile/Operational
# Source: NetworkProfile
# Event ID: 10000
# enable network when detect event(when conneted network) :10000
$IP=Get-NetIPAddress -AddressFamily IPv4
$IP | ForEach-Object {
if ($_.IPAddress -notlike '10.10.10.*')
{
if ($_.IPAddress -ne '127.0.0.1')
{
Disable-NetAdapter -Name $_.InterfaceAlias -Confirm:$False
}
}
}
enable.ps1
# Log: Microsoft-Windows-NetworkProfile/Operational
# Source: NetworkProfile
# Event ID: 10001
# enable network when detect event(disconneted network) :10001
$NIC=Get-NetAdapter
$NIC | ForEach-Object {
if ($_.Status -eq 'Disabled')
{
Enable-NetAdapter -Name $_.Name -Confirm:$False
}
}
#Re-Check again after 5 secs.
# if still use out-side IP, disable it again.
Start-Sleep -s 5
$IP=Get-NetIPAddress -AddressFamily IPv4
$IP | ForEach-Object {
if ($_.IPAddress -notlike '10.10.10.*')
{
if ($_.IPAddress -ne '127.0.0.1')
{
Disable-NetAdapter -Name $_.InterfaceAlias -Confirm:$False
}
}
}
Keyword: powershell , GPO , eventlog