Raphire / Win11Debloat

A simple, easy to use PowerShell script to remove pre-installed apps from Windows, disable telemetry, remove Bing from Windows search as well as perform various other changes to declutter and improve your Windows experience. This script works for both Windows 10 and Windows 11.
MIT License
12.88k stars 546 forks source link

only works on admin user account and not second account #72

Open anonfaded opened 3 months ago

anonfaded commented 3 months ago

It worked fine on admin main account on windows 11, but on second user account it isn't working. I opened powershell with admin priv but the script doesn't run so then i logged in from admin account and opened power shell > changed directory to other user and then used commands, it showed in terminal that it worked but it didn't remove anything when i logged in again from other account.

Raphire commented 3 months ago

Heya,

Is there a particular error showing when attempting to run the script for the second user?

Sidenote: The script applies most of the changes to the current logged in user, changing directory will not change the behaviour of the script.

anonfaded commented 3 months ago

changing directory will not change the behaviour of the script.

oh so this is the issue then. The error i get on second user is that it needs admin priv to run the script, even when i open the power shell as admin, it still says that it needs admin priv to run the script.

And when i double click the script it just blinks the terminal window and closes itself, tried the advance method and all mentioned in README but it didn't work at all. It should work when power shell is opened as admin but idk why it still asked for admin priv.

Raphire commented 3 months ago

Interesting. I'll try to do some testing of my own to see if I can reproduce this issue.

anonfaded commented 3 months ago

Interesting. I'll try to do some testing of my own to see if I can reproduce this issue.

Yeah you can reproduce it by using it on second user account and it will probably be same as what i got. On Admin power shell window it was still asking for admin rights so here idk if its the issue with the script or its how windows works on accounts with no admin priv.

johnnyq commented 3 months ago

yes I can confirm the same here. We created a localAdmin account Ran it on there just fine then we joined it to the active directory domain logged in as a regular domain user attempted to run the debloat and asked for admin password in which we entered. It ran though its paces but didnt actually do anything in the end

Raphire commented 3 months ago

Heya,

Just wanted to do a quick update. I have been able to reproduce this issue myself.

The issue stems from the fact that the user context changes when running an elevated powershell prompt from a standard user account. This means the script will apply the changes to the admin account instead of the intended account.

I'll try to look into solutions for this issue and report back soon 🙃

anonfaded commented 3 months ago

@Raphire Also i wanted to ask you that how to remove this windows update icon from start menu or stop windows from asking to update? idk whats the issue with it but it just keeps failing when i try to install the update. So i want to remove it completely. image

It always fails when it reaches 25% image

Raphire commented 3 months ago

@Raphire Also i wanted to ask you that how to remove this windows update icon from start menu or stop windows from asking to update? idk whats the issue with it but it just keeps failing when i try to install the update. So i want to remove it completely. image

It always fails when it reaches 25% image

There's ways to disable the icon as seen here: https://www.tenforums.com/tutorials/142276-enable-disable-windows-update-status-taskbar-icon-windows-10-a.html

But I would rather look into why the update fails and try to solve that. This recent wifi exploit is a great example of why it's important to keep your system up to date.

P.s. I have enabled discussions on this repo, this is a better place for these kinds of questions, rather than in this issue.

Knight-sysdev commented 1 month ago

I'm trying to troubleshoot this myself and i can really only think of elevating and de-elevating the user's permissions but that's a clear security risk.

Same issue with Sophia Script too, anyone got any other Debloating software? Specifically, something I can deploy.

Raphire commented 1 month ago

I'm trying to troubleshoot this myself and i can really only think of elevating and de-elevating the user's permissions but that's a clear security risk.

Same issue with Sophia Script too, anyone got any other Debloating software? Specifically, something I can deploy.

The reason for this issue comes down to the fact that the elevated powershell prompt is run within the context of the administrator account, not the logged in user. I am working on something that would allow you to select which user to apply changes to, but I haven't had a lot of time to work on it lately so I don't have an ETA unfortunately.

Raphire commented 1 month ago

Accidentally closed this issue, apologies 😅