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
This commit is contained in:
Gajendra Babu Thokala [MSFT] 2019-04-29 09:42:01 -07:00 committed by GitHub
parent 7dd819c4b5
commit 896442a0bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 }