Replies: 5 comments 3 replies
-
If you're trying to automate it you probably want to run the |
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
EDIT: I have found that it seems to do with the fact that Windows restricts powershell scripts by default. The window will just close. I'll see if I can find a workaround without forcing the executionpolicy to an unsafe setting. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help :) . I'm not sure I'll be able to try tomorow but if not I'll definitely try the day after. I suppose it might be possible to replace the -RunDefaults switch by a chosen list of other switches (-arg1 -arg2 ... -argn) ? The way I was launching the script was the following : a powershell command is launching a script I named Win11Debloat_custom.ps1 : This Win11Debloat_Custom.ps1 script is situated in the same directory (Win11Debloat-master) as Win11Debloat.ps1 it is launching. The content of this Win11Debloat_Custom.ps1 script is the following : $argumentList = @("-Silent","-RemoveApps","-RemoveW11Outlook","-RemoveGamingApps","-DisableDVR","-DisableSuggestions","-DisableLockscreenTips","-TaskbarAlignLeft","-ShowSearchIconTb","-HideChat","-DisableWidgets","-DisableCopilot","-DisableRecall","-DisableDesktopSpotlight","-HideTaskview") $scriptArguments = $argumentList -join ' ' $scriptPath="C:\some_path\Win11Debloat-master\Win11Debloat.ps1" Invoke-Expression "& '"$scriptPath'" $argumentList" When I manually execute Win11Debloat_Custom.ps1 it is lauching successfully Win11Debloat.ps1 (a powershell windows opens and all steps are executed successfully and the modifications applied). When I'm running the Win11Debloat_Custom.ps1 script automatically with the powershell command above (the command is executed with SYSTEM rights), the script seems be executed (there seems to be no error interrupting it), but in fact it does not apply the modifications and I get the following output of the powershell command (the one launching Win11Debloat_Custom.ps1) :
Unfortunately, I am not versed enough in powershell to analyze this output :-/. However, the -1 between some tags make me wonder if there might not be some failures during the execution ? I'll try as soon as possible to run the script with the command you provided and let you know if it works. |
Beta Was this translation helpful? Give feedback.
-
The software I use to automate installations/configurations is running with/using python, the powershell command is launched with python functions using among other things the psutil.Popen() method. So the process calling the powershell script is indeed run under the system account. (I tried the powershell command your suggested , but it leads to the same results). It seems to me that the problem is indeed coming from the script being executed with the system account, as when I launch manually the Win11debloat_custom.ps1 script (which is launching Win11debloat.ps1) it does execute successfully. Would there somehow be a possibility to run the Win11debloat.ps1 script under the system account ? |
Beta Was this translation helpful? Give feedback.
-
I tried the last two days to execute the script in an automated and silent way (using the -silent switch and other ones of interest) on different W11 machines but to no avail. If I ran the same script manually within a powershell shell on any of these machines, it works but not in an automated way. The script is nevertheless executed with admin rights (using -verb runas in a start-process powershell command) and the execution policy of the local machine scope set to unrestricted (the process scope seems not specifically relevant). Any idea of what could be the problem ?
Beta Was this translation helpful? Give feedback.
All reactions