-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathServer_restart_services.ps1
56 lines (35 loc) · 1.29 KB
/
Server_restart_services.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
<#
.SYNOPSIS
Think powershell think Mr-ITpro.com !!! FUN STUFF
.EXAMPLE
'one', 'two', 'three' TonyB_default.ps1
.EXAMPLE
TonyB_default.ps1 -computername localhost
.EXAMPLE
TonyB_default.ps1 -computername one, two, three
.EXAMPLE
get-content <Somelist.txt> or <anylist.csv> | TonyB_default.ps1
.PARAMETER computername
one or more computername, or IP address... peace to America!
.LINK
https://github.com/officecigar/windows_scripts/blob/master/serverhealth5.ps1
#>
[CmdletBinding(HelpURI='http://google.com')]
Param(
[Parameter(Mandatory=$true,ValuefromPipeline=$true)]
[string []]$serviceSrv_restart
)
Begin {
$host.UI.RawUI.WindowTitle = "Restart Services on servers"
#$day = Read-Host "how many days do you want to go back for patches"
#Write-Host "Please wait this may take a few Minutes..."
}
Process {
#enter your name here # or un comment the line below
$services_name = Read-Host " enter your service name " # enter your service name
Foreach ($service_restart in $serviceSrv_restart) {
Get-Service -Name $services_name -ComputerName $service_restart | Restart-Service
}
}
end{
}