Skip to content

Commit ef86f5f

Browse files
committed
fix gpupdate command
1 parent 141a452 commit ef86f5f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/lib/features/tweaks/security/security_service.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ class SecurityServiceImpl implements SecurityService {
153153

154154
await WinPackageService.uninstallPackage(WinPackageType.defenderRemoval);
155155

156-
await shell.run(
157-
'start /WAIT /MIN /B "" "%systemroot%\\System32\\gpupdate.exe" /Target:Computer /Force',
156+
await runPSCommand(
157+
"& \$env:SystemRoot\\System32\\gpupdate.exe /Target:Computer /Force",
158158
);
159159

160160
await Future.wait([
@@ -347,8 +347,8 @@ class SecurityServiceImpl implements SecurityService {
347347
),
348348
]);
349349

350-
await shell.run(
351-
'start /WAIT /MIN /B "" "%systemroot%\\System32\\gpupdate.exe" /Target:Computer /Force',
350+
await runPSCommand(
351+
"& \$env:SystemRoot\\System32\\gpupdate.exe /Target:Computer /Force",
352352
);
353353

354354
if (File(_mpCmdRunString).existsSync()) {

src/lib/utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ bool isProcessRunning(String name) {
8585
}
8686

8787
/// PowerShell helper for executing commands with faster startup time
88-
Future<String> runPSCommand(String command) async {
88+
Future<String> runPSCommand(String command, {bool stdout = false}) async {
8989
final result = await Process.run('powershell', [
9090
'-NoProfile',
9191
'-NonInteractive',
@@ -107,7 +107,7 @@ Future<String> runPSCommand(String command) async {
107107
result.exitCode,
108108
);
109109
}
110-
logger.i('ps_command: $command');
110+
logger.i('ps_command: $command; ${stdout ? result.stdout : ''}');
111111

112112
return result.stdout.toString();
113113
}

0 commit comments

Comments
 (0)