国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(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ó)家法律
广安市| 长汀县| 岚皋县| 滦南县| 武清区| 邹城市| 贵阳市| 博野县| 庐江县| 建德市| 辉南县| 宣汉县| 民勤县| 广平县| 分宜县| 平陆县| 华池县| 上高县| 南昌市| 娄烦县| 永昌县| 酉阳| 伊宁市| 龙南县| 民权县| 甘泉县| 灌南县| 晋城| 婺源县| 西藏| 缙云县| 平利县| 闸北区| 尼木县| 璧山县| 桃园市| 新余市| 恩平市| 大关县| 哈巴河县| 黄梅县|