-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptHub.ps1
More file actions
81 lines (74 loc) · 3.17 KB
/
ScriptHub.ps1
File metadata and controls
81 lines (74 loc) · 3.17 KB
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
function Show-Menu {
Write-Host "Powershell Scripts" -ForegroundColor Cyan
Write-Host "-------------------"
Write-Host "1: Disk Management"
Write-Host "2: Remote Management"
Write-Host "3: User Management"
Write-Host "4: Exit"
}
function Show-DiskManagementMenu {
Write-Host "Disk Management" -ForegroundColor Cyan
Write-Host "1: Cleanup Temporary Files"
Write-Host "2: Defragment C Drive"
Write-Host "3: Back to Main Menu"
}
function Show-RemoteManagementMenu {
Write-Host "Remote Management" -ForegroundColor Cyan
Write-Host "1: Enable/Disable Remote Desktop"
Write-Host "2: Install/Uninstall or Enable/Disable OpenSSH"
Write-Host "3: Back to Main Menu"
}
function Show-UserManagementMenu {
Write-Host "User Management" -ForegroundColor Cyan
Write-Host "1: Add/Remove User and Manage Passwords"
Write-Host "2: Logoff Selected User's Session"
Write-Host "3: Back to Main Menu"
}
function Run-DiskManagement {
do {
Show-DiskManagementMenu
$choice = Read-Host "Enter your choice (1-3)"
switch ($choice) {
1 { iex (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/nirravv/powershell-scripts/main/DiskManagement/disk_cleanup.ps1").Content }
2 { iex (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/nirravv/powershell-scripts/main/DiskManagement/disk_defragmentation.ps1").Content }
3 { return }
default { Write-Host "Invalid choice, please select again." -ForegroundColor Red }
}
} while ($true)
}
function Run-RemoteManagement {
do {
Show-RemoteManagementMenu
$choice = Read-Host "Enter your choice (1-3)"
switch ($choice) {
1 { iex (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/nirravv/powershell-scripts/main/RemoteManagement/Enable-DisableRemoteDesktop.ps1").Content }
2 { iex (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/nirravv/powershell-scripts/main/RemoteManagement/Enable-DisableOpenSSH.ps1").Content }
3 { return }
default { Write-Host "Invalid choice, please select again." -ForegroundColor Red }
}
} while ($true)
}
function Run-UserManagement {
do {
Show-UserManagementMenu
$choice = Read-Host "Enter your choice (1-3)"
switch ($choice) {
1 { iex (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/nirravv/powershell-scripts/main/UserManagement/UserManagement.ps1").Content }
2 { iex (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/nirravv/powershell-scripts/main/UserManagement/LogoffUserSession.ps1").Content }
3 { return }
default { Write-Host "Invalid choice, please select again." -ForegroundColor Red }
}
} while ($true)
}
# Main Menu
do {
Show-Menu
$mainChoice = Read-Host "Enter your choice (1-4)"
switch ($mainChoice) {
1 { Run-DiskManagement }
2 { Run-RemoteManagement }
3 { Run-UserManagement }
4 { Write-Host "Exiting script." -ForegroundColor Green; exit }
default { Write-Host "Invalid choice, please select again." -ForegroundColor Red }
}
} while ($true)