五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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ó)家法律
伊金霍洛旗| 郧西县| 兴国县| 横峰县| 甘泉县| 舟曲县| 景谷| 郴州市| 女性| 同德县| 伽师县| 曲靖市| 霞浦县| 区。| 淳化县| 和硕县| 霍州市| 双牌县| 绥德县| 临猗县| 吴忠市| 全州县| 称多县| 开鲁县| 藁城市| 河北省| 甘德县| 新宁县| 景泰县| 纳雍县| 夏津县| 石首市| 蒲江县| 丰都县| 富民县| 洮南市| 云南省| 蓝山县| 福州市| 郯城县| 玉溪市|