Created
November 10, 2011 16:18
-
-
Save florianbeisel/1355266 to your computer and use it in GitHub Desktop.
Changing the Network Category to Private
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
powershell -ExecutionPolicy unrestricted -scope CurrentUser .\setNetworkCategoryToPrivate.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Schedules the Powershell Script to run every boot. Eventually this should be changed to "BEIANMELDUNG", this is done by changing the /SC Parameter. | |
REM Eventually this script should be run as administrator or at least it should be made sure, that the /RU and /RP Parameter are being set according to the system. | |
SCHTASKS /Create /TN AutomaticNetworkCategory /TR "powershell -ExecutionPolicy unrestricted -scope CurrentUser .\setNetworkCategoryToPrivate.ps1" /SC BEIMSTART |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$nwcon = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}")).getNetworkConnections() | |
$res = $nwcon | % { | |
$_.GetNetwork().SetCategory(1) | |
} | |
# More unreadable (but tested form) | |
# [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}")).getNetworkConnections() | % {$_.GetNetwork().SetCategory(1)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment