-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmet1.ps1
70 lines (54 loc) · 4.92 KB
/
met1.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
<#
.SYNOPSIS
Creates a menu for scripts that you already have in a certain location. This will help you to centralize your scripts. You can aslo run your scripts from the menu, which will lauch a new powershell instance.
.EXAMPLE
navagate to here and run script.
C:\temp\toolsbox\met1.ps1
.EXAMPLE
Below is a screen example.
1. enableres.ps1
2. testgood.ps1
Enter selection: 2
.EXAMPLE
met1.ps1
.PARAMETER computername
one or more computername, or IP address... peace to America!
Think powershell think Mr-ITpro.com !!! FUN STUFF
.LINK
http://www.mr-itpro.com
#>
Write-Host " "
Write-Host " "
Write-Host " "
Write-Host " "
Write-Host " "
Write-Host " ########################################################################################################################################################### "
Write-Host " __ _______ __________ "
Write-Host " / |/ / __ \ / _/_ __/____ _________ _________ ____ ___ "
Write-Host " / /|_/ / /_/ /______ / / / / / __ \/ ___/ __ \ / ___/ __ \/ __ `__ \ "
Write-Host " / / / / _, _//_____/_/ / / / / /_/ / / / /_/ /_/ /__/ /_/ / / / / / / "
Write-Host " /_/ /_/_/ |_| /___/ /_/ / .___/_/ \____/(_)___/\____/_/ /_/ /_/ "
Write-Host " /_/ "
Write-Host " " -ForegroundColor Green -BackgroundColor black
Write-Host "############################################################################################################################################################ "
Write-Host " " -ForegroundColor white -BackgroundColor Blue
Write-Host " " -ForegroundColor green -BackgroundColor White
Write-Host " " -ForegroundColor White -BackgroundColor Red
Write-Host " "
$host.UI.RawUI.WindowTitle = "Self Managing Scripts - Menu for Scripts "
$processes = ls -Path C:\scripts\TonyB\toolsbox\testmenulist
$menu = @{}
for ($i=1;$i -le $processes.count; $i++) {
Write-Host "$i. $($processes[$i-1].name)"
Write-Host ""
$menu.Add($i,($processes[$i-1].name))
}
[int]$ans = Read-Host 'Enter selection'
$selection = $menu.Item($ans)
Write-Host ""
if ($selection -eq $null){
exit
}
Get-ChildItem -Path C:\scripts\TonyB\toolsbox\testmenulist -name $selection | Start-Process PowerShell.exe -argument "-noexit -nologo -noprofile -command C:\scripts\TonyB\toolsbox\testmenulist\$selection"
powershell.exe C:\scripts\TonyB\toolsbox\met1.ps1
#start-process powershell.exe -argument "-noexit -nologo -noprofile -command c:\temp $selection"