-
-
Notifications
You must be signed in to change notification settings - Fork 223
/
stop.ps1
56 lines (49 loc) · 1.4 KB
/
stop.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
Stop the OneMore add-in dllhost process and then the OneNote process
#>
param()
Begin
{
$guid = "{88AB88AB-CDFB-4C68-9C3A-F10B75A5BC61}";
}
Process
{
# CommandLine == C:\WINDOWS\system32\DllHost.exe /Processid:{88AB88AB-CDFB-4C68-9C3A-F10B75A5BC61}
$processId = gcim Win32_Process | select ProcessId, CommandLine | `
where { $_.CommandLine -and $_.CommandLine.Contains($guid) } | `
foreach { $_.ProcessId }
if ($processId)
{
Write-Host "... stopping dllhost" -Fore DarkYellow
taskkill /pid $processId /f
}
else
{
Write-Host '... dllhost not found' -Fore DarkGray
}
$processId = gcim Win32_Process | select ProcessId, Name | `
where { $_.Name -eq 'ONENOTE.EXE' } | `
foreach { $_.ProcessId }
if ($processId)
{
Write-Host "... stopping ONENOTE.EXE" -Fore DarkYellow
taskkill /fi "pid gt 0" /im ONENOTE.exe /t /f
}
else
{
Write-Host '... ONENOTE.EXE not found' -Fore DarkGray
}
$processId = gcim Win32_Process | select ProcessId, Name | `
where { $_.Name -eq 'OneMoreTray.exe' } | `
foreach { $_.ProcessId }
if ($processId)
{
Write-Host "... stopping OneMoreTray.exe" -Fore DarkYellow
taskkill /fi "pid gt 0" /im ONENOTE.exe /t /f
}
else
{
Write-Host '... OneMoreTray.exe not found' -Fore DarkGray
}
}