From e7652aee1484777d9ce4c40a660fea225a0eaeb1 Mon Sep 17 00:00:00 2001 From: "Chris K.Y. FUNG" <8746768+chriskyfung@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:48:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20compatability=20issues=20i?= =?UTF-8?q?n=20PowerShell=20scrips=20#6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added the #Requires statement to specify the minimum version of PowerShell that the script requires Fixes [#6](https://github.com/chriskyfung/My-PowerShell-Scripts/issues/6) --- Bluestacks/Optimize-BluestacksVEthernet.ps1 | 18 +++++++++--------- Test-URL.ps1 | 2 ++ Windows/Get-DiskReliabilityCounter.ps1 | 8 ++++---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Bluestacks/Optimize-BluestacksVEthernet.ps1 b/Bluestacks/Optimize-BluestacksVEthernet.ps1 index 1f4501c..d5e8001 100644 --- a/Bluestacks/Optimize-BluestacksVEthernet.ps1 +++ b/Bluestacks/Optimize-BluestacksVEthernet.ps1 @@ -1,5 +1,3 @@ -#Requires -RunAsAdministrator - <# .SYNOPSIS Optimize Virtual Ethernet Adapter Performance for BlueStacks with Hyper-V Enabled @@ -12,15 +10,17 @@ .OUTPUTS None - + .NOTES - Version: 1.1.3 + Version: 1.1.4 Author: chriskyfung - Website: https://chriskyfung.github.io - Creation Date: 2023-03-09 - Last Modified: 2023-07-01 + Original from: https://gist.github.com/chriskyfung/073e0fbfeeb7b5c1e7d13dc94d638bb9 #> +#Requires -Version 3.0 +#Requires -PSEdition Desktop +#Requires -RunAsAdministrator + Try { # Disable all Virtual Ethernet Adapters except the Virtual Ethernet Adapter for BlueStacks @@ -34,7 +34,7 @@ Try { Disable-NetAdapterRss -Name "vEthernet (*)" # Disable Receive segment coalescing (RSC) for all Virtual Ethernet Adapters. Learn more: https://learn.microsoft.com/en-us/windows-hardware/drivers/network/overview-of-receive-segment-coalescing Disable-NetAdapterRsc -Name "vEthernet (*)" - + # Disable specific adapter bindings on vEthernet (BluestacksNxt). Learn more: https://learn.microsoft.com/en-us/powershell/module/netadapter/disable-netadapterbinding Disable-NetAdapterBinding -Name "vEthernet (BluestacksNxt)" -ComponentID @("ms_tcpip6", "ms_server", "ms_lltdio", "ms_rspndr") # Set Sets the RSS properties on vEthernet (BluestacksNxt). Learn more: https://learn.microsoft.com/en-us/powershell/module/netadapter/set-netadapterrss @@ -51,7 +51,7 @@ Try { Write-Host "`nvEthernet (BluestacksNxt) - Receive Segment Coalescing (RSC):`n" (Get-NetAdapterRsc -Name "vEthernet (BluestacksNxt)" | Format-List -Property "*Enabled" | Out-String).Trim() - + Write-Host "`n" } Catch { diff --git a/Test-URL.ps1 b/Test-URL.ps1 index ccf5e18..6a5b1f5 100644 --- a/Test-URL.ps1 +++ b/Test-URL.ps1 @@ -1,3 +1,5 @@ +#Requires -Version 3.0 + $urls = @("https://www.google.com", "https://www.bing.com", "https://www.yahoo.com", "https://www.example.com") foreach ($url in $urls) { diff --git a/Windows/Get-DiskReliabilityCounter.ps1 b/Windows/Get-DiskReliabilityCounter.ps1 index c47bd86..237c1da 100644 --- a/Windows/Get-DiskReliabilityCounter.ps1 +++ b/Windows/Get-DiskReliabilityCounter.ps1 @@ -9,17 +9,17 @@ None .NOTES - Version: 1.0.0 + Version: 1.0.1 Author: chriskyfung Website: https://chriskyfung.github.io - Creation Date: 2023-06-24 - Last Modified: 2023-06-24 #> +#Requires -Version 3.0 +#Requires -PSEdition Desktop #Requires -RunAsAdministrator Get-Disk | ForEach-Object { - ($Disk = $_) | Get-StorageReliabilityCounter | + ($Disk = $_) | Get-StorageReliabilityCounter | Select-Object DeviceId, @{ Name="FriendlyName";