浏览代码

Added check to enable DMWAppushservice

Added a function to set the startup type of the DMWAppushservice to Automatic, and to start it after if it isn't started.
Richard Newton 6 年之前
父节点
当前提交
053e51dd03
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      Windows10SysPrepDebloater.ps1

+ 5 - 4
Windows10SysPrepDebloater.ps1

@@ -25,8 +25,6 @@ Function Begin-SysPrep {
         #Stop WindowsStore Installer Service and set to Disabled
         #Stop WindowsStore Installer Service and set to Disabled
         Write-Verbose -Message ('Stopping InstallService')
         Write-Verbose -Message ('Stopping InstallService')
         Stop-Service InstallService
         Stop-Service InstallService
-        Write-Verbose -Message ('Setting InstallService Startup to Disabled')
-        & Set-Service -Name InstallService -StartupType Disabled
  }
  }
 
 
 #Creates a PSDrive to be able to access the 'HKCR' tree
 #Creates a PSDrive to be able to access the 'HKCR' tree
@@ -214,8 +212,11 @@ Function CheckDMWService {
 
 
   Param([switch]$Debloat)
   Param([switch]$Debloat)
   
   
-  If (Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) {
-        Start-Service -Name dmwappushservice }
+If (Get-Service -Name dmwappushservice | Where-Object {$_.StartType -eq "Disabled"}) {
+    Set-Service -Name dmwappushservice -StartupType Automatic}
+
+If(Get-Service -Name dmwappushservice | Where-Object {$_.Status -eq "Stopped"}) {
+   Start-Service -Name dmwappushservice} 
 }
 }
 
 
 Function CheckInstallService {
 Function CheckInstallService {