-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNetzwerktypenwechsler2.ps1
81 lines (52 loc) · 2.72 KB
/
Netzwerktypenwechsler2.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<#
Netzwerktypenwechsler.ps1
.DESCRIPTION
Netzwerktypen Schnellwechsel
https://github.com/thelamescriptkiddiemax/powershell
#>
#--- NetzTyp ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Clear-Host
Write-Host " "
Write-Host " ___ ___ __ ___ __ ___ __ ___"
Write-Host " |\ | |__ | / | | |__ |__) |__/ | \ / |__) |__ |\ |"
Write-Host " | \| |___ | /_ |/\| |___ | \ | \ | | | |___ | \|"
Write-Host " ___ __ __ ___ __ "
Write-Host " | | |__ / |__| /__ | |__ |__)"
Write-Host " |/\| |___ \__ | | __/ |___ |___ | \"
Write-Host " "
#--- NIC-Auswahl --------------------------------------------------------------------------------------------------------------------------------------------------------
$adapter = Get-NetConnectionProfile
$menu = @{}
for ($i=1 ; $i -le $adapter.count ; $i++) {
Write-Host "$i. $($adapter[$i-1].Name)"
$menu.Add($i,($adapter[$i-1].Name))
}
Write-Host " "
Write-Host " Hi! Ich setze Dir deine Netzwerke auf Privat!"
Write-Host " "
[int]$ans = Read-Host 'An welchem Adapter soll ich rumfummeln?'
$selection = $menu.Item($ans)
Write-Host " "
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------
do {
$LanTypNR = Read-Host " Netzwerktyp? 1 = Pirvates Netzwerk 2 = Oeffentliches Netzwerk"
} until ($("1","2").Contains($LanTypNR))
$Title = "Netzwerktyp"
$Message = "Privates oder Oeffentliches Netzwerk?"
$Privat = New-Object System.Management.Automation.Host.ChoiceDescription "&Privat", `
"Privat"
$MacOSX = New-Object System.Management.Automation.Host.ChoiceDescription "&MacOSX", `
"MacOSX"
$Options = [System.Management.Automation.Host.ChoiceDescription[]]($Privat, $MacOSX)
$SelectOS = $host.ui.PromptForChoice($title, $message, $options, 0)
switch($SelectOS)
{
0 {Write-Host "You love Windows ME!"}
1 {Write-Host "You must be an Apple fan boy"}
}
#--- Netzwerktypen Wechsel ---------------------------------------------------------------------------------------------------------------------------------------------------
Write-Host " Mache $selection zu $LanTyp Netzwerk!"
Set-NetConnectionProfile -Name $selection -NetworkCategory $LanTyp
Start-Sleep -s 1
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------
exit