-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTurn_On_NetAdapter.ps1
33 lines (20 loc) · 1.08 KB
/
Turn_On_NetAdapter.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
cls
#Declaration
$Computer= Read-Host -Prompt "Enter PC Name"
$cred= Get-Credential -Message "Enter your TA Account"
#Enable PS Remoting temporarily/On Next windows start it will be disabled
Start-Process "cmd.exe" "/c .\Enable-remoting.bat" -Wait
cls
Invoke-Command -Computer $Computer -Credential $cred -Scriptblock {
Get-NetAdapter |Where status -ne up
}
#Process for enabling
$Determine= Read-Host -Prompt "
Enter 1 for enable 2 for exit
"
if ($Determine -eq '1') {
Invoke-Command -Computer $Computer -Credential $cred -Scriptblock {Get-NetAdapter |Where status -ne up | Enable-NetAdapter }
Invoke-Command -Computer $Computer -Credential $cred -Scriptblock {Enable-NetAdapter -Name WLAN -Confirm:$false}
Invoke-Command -Computer $Computer -Credential $cred -Scriptblock {Get-NetAdapter}
}
else { exit }