Browse Source

Updateded to Show Message to run as administrator

Updateded to Show Message to run as administrator. 

When run without elevated below message would be shown. Which is clear to run as administrator

.\set-dockernat-networkategory-to-private.ps1 : The script 'set-dockernat-networkategory-to-private.ps1' cannot be run
because it contains a "#requires" statement for running as Administrator. The current Windows PowerShell session is
not running as Administrator. Start Windows PowerShell by  using the Run as Administrator option, and then try running
the script again.
At line:1 char:1
+ .\set-dockernat-networkategory-to-private.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (set-dockernat-n...-to-private.ps1:String) [], ScriptRequiresException
    + FullyQualifiedErrorId : ScriptRequiresElevation
pull/1019/head
Gajendra Babu Thokala [MSFT] 5 years ago
committed by GitHub
parent
commit
896442a0bf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      cli-windows/set-dockernat-networkategory-to-private.ps1

+ 2
- 1
cli-windows/set-dockernat-networkategory-to-private.ps1 View File

@ -1 +1,2 @@
Get-NetConnectionProfile | Where-Object { $_.InterfaceAlias -match "(DockerNAT)" } | ForEach-Object { Set-NetConnectionProfile -InterfaceIndex $_.InterfaceIndex -NetworkCategory Private }
 #Requires -RunAsAdministrator
Get-NetConnectionProfile | Where-Object { $_.InterfaceAlias -match "(DockerNAT)" } | ForEach-Object { Set-NetConnectionProfile -InterfaceIndex $_.InterfaceIndex -NetworkCategory Private }

Loading…
Cancel
Save