无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

修改ip接口的躍點(diǎn)數(shù)

2023-06-06 17:37 作者:限量版范兒  | 我要投稿

title: 修改網(wǎng)絡(luò)配置的 InterfaceMetric categories: ?- OS ?- Windows ?- 批處理

使用腳本修改網(wǎng)卡躍點(diǎn)數(shù) InterfaceMetric

使用到的接口

  1. Get-NetIPInterface

  2. Set-NetIPInterface

  3. Get-NetAdapter

需求描述

需要修改當(dāng)前躍點(diǎn)數(shù)為?1?的ip接口,修改其躍點(diǎn)數(shù)為?90

解決方案

設(shè)置ip接口的躍點(diǎn)數(shù)均需要管理員權(quán)限

思路一

源文件

  1. 通過?Get-NetIPInterface?獲取需要修改的IP接口

  2. 通過?Set-NetIPInterface?修改躍點(diǎn)數(shù)

$ChangeIfm = 1 $WangToChangeIfm = 90 # 獲取 InterfaceMetric 為 1 的 -InterfaceIndex $NetCard = (Get-NetIPInterface ?-InterfaceMetric $ChangeIfm).ifAlias $netInterfaceIndex = (Get-NetIPInterface -AddressFamily IPv4 -InterfaceMetric $ChangeIfm).ifIndex Write-Output "檢索InterfaceMetric為 [${ChangeIfm}] 列表: `n ${NetCard}" Write-Output "Index 為: ?${netInterfaceIndex}" Set-NetIPInterface -InterfaceIndex $netInterfaceIndex -InterfaceMetric $WangToChangeIfm Write-Output "已修改 ${NetCard} 的 InterfaceMetric 為 ${WangToChangeIfm}"

思路二

源文件

使用過濾器篩選需要修改的ip接口,再通過?Set-NetIPInterface?修改躍點(diǎn)數(shù)

# 獲取 InterfaceMetric 為 1 的 -InterfaceIndex $NetCard = (Get-NetAdapter | Where-Object -FilterScript {$_.ifIndex -eq 10}) Write-Output $NetCard Set-NetIPInterface -InterfaceIndex $NetCard.ifIndex -AddressFamily IPv6 -InterfaceMetric 90

官方demo

修改 LinkSpeed 為 100 Mbps 的網(wǎng)絡(luò)的 InterfaceMetric 為 21

Get-NetAdapter | Where-Object -FilterScript {$_.LinkSpeed -Eq "100 Mbps"} | Set-NetIPInterface -InterfaceMetric 21

提升管理員權(quán)限

cmd提權(quán)

@echo off ::1 獲取管理員權(quán)限 %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit ::2 執(zhí)行操作 set curpath=%~dp0 set file=ModifyIfm.ps1 set execPath=%curpath%%file% echo %execPath% powershell.exe -ExecutionPolicy ByPass -File %execPath%

powershell 提權(quán)

if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { ? ?if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { ? ? ? ?$Command = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments ? ? ? ?Start-Process -FilePath PowerShell.exe -Verb RunAs -ArgumentList $Command ? ? ? ?Exit } }

原文鏈接:https://www.dianjilingqu.com/756397.html

修改ip接口的躍點(diǎn)數(shù)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
新竹市| 张掖市| 石台县| 辰溪县| 浮梁县| 广灵县| 涞水县| 上犹县| 甘泉县| 西藏| 三江| 民权县| 祁阳县| 广灵县| 江北区| 玉环县| 三明市| 乐山市| 新乡市| 千阳县| 错那县| 临汾市| 环江| 新民市| 民和| 睢宁县| 霸州市| 浙江省| 漠河县| 内黄县| 大方县| 阿瓦提县| 临潭县| 赤城县| 荔波县| 和平区| 重庆市| 嵩明县| 高唐县| 漳平市| 泰州市|