-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwin10-disable-services.ps1
73 lines (54 loc) · 2.08 KB
/
win10-disable-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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<#
Services to disable
AllJoyn Router Service:
AJRouter
Download Maps Manager:
MapsBroker
HomeGroup Services:
HomeGroupListener
HomeGroupProvider
Remote Registry:
RemoteRegistry
Windows Media Player Sharing Service:
WMPNetworkSvc
Xbox Services:
XboxGipSvc
XblAuthManager
XblGameSave
XboxNetApiSvc
Diagnostic Tracking:
DiagTrack
#>
function Test-Admin
{
$wid = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$prp = New-Object System.Security.Principal.WindowsPrincipal($wid)
$adm = [System.Security.Principal.WindowsBuiltInRole]::Administrator
$prp.IsInRole($adm)
}
if ((Test-Admin) -eq $false)
{
Write-host "You need Administrator privileges to run this." -ForegroundColor Red
# Abort the script
# this will work only if you are actually running a script
# if you did not save your script, the ISE editor runs it as a series
# of individual commands, so break will not break then.
break
}
ELSE
{
# Write-Host "When you got to this point, you know the script has Admin privileges." -ForegroundColor Green
Write-Host -ForegroundColor Yellow "Disabling Services"
Set-Service -Status Stopped -StartupType Disabled -Name AJRouter
Set-Service -Status Stopped -StartupType Disabled -Name MapsBroker
Set-Service -Status Stopped -StartupType Disabled -Name HomeGroupListener
Set-Service -Status Stopped -StartupType Disabled -Name HomeGroupProvider
Set-Service -Status Stopped -StartupType Disabled -Name RemoteRegistry
Set-Service -Status Stopped -StartupType Disabled -Name WMPNetworkSvc
Set-Service -Status Stopped -StartupType Disabled -Name XboxGipSvc
Set-Service -Status Stopped -StartupType Disabled -Name XblAuthManager
Set-Service -Status Stopped -StartupType Disabled -Name XblGameSave
Set-Service -Status Stopped -StartupType Disabled -Name XboxNetApiSvc
Set-Service -Status Stopped -StartupType Disabled -Name DiagTrack
Write-Host -ForegroundColor Green "Services Disabled"
}