Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

Hi all,

 

I've got a .ps1 script that removes Edge on the taskbar and replaces it with Chrome, however it also removes any other programs that have been pinned, so I'm looking for this to run once when a user logs in for the first time only per machine. Is there a way to do this? It looks like logon scripts work every time you log in. Or have any of you found another way around replacing Edge in the taskbar? :(

 

Thank you in advance :)

Posted

Can't you write a file to the user area at the end of the operation and check if it exists at the beginning. If it does, exit.

 

You can do this with batch files, so assuming you can with PS!

  • Thanks 1
Posted
Okay I've found a slightly different way around it that only requires a registry entry to be deleted, but again would only want this running on the very first login otherwise it will keep wiping anything pinned to the taskbar. What command would I use in this case? I'm looking at IF commands in cmd but it's too late in the day to wrap my head around it :(
Posted

This is what I use to set the WinHttp proxy:

 

@ECHO OFF

If EXIST "C:\WinHTTP.txt" goto :FINISHED

%systemroot%\regedit.exe /s \\DC-01\netlogon\WinHTTP\WinHttpProxy.reg

echo CopyCompleted >> "C:\WinHTTP.txt"

:FINISHED

exit

  • Thanks 1
Posted
Check if there is a pinned edge button on the taskbar then remove it if you found it? That way you don't need to care if you ran the script before (and as a bonus it'll remove the pin if it gets readded at a later date for some reason). The location pinned applications are stored are in
%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

Posted
This is what I use to set the WinHttp proxy:

 

@ECHO OFF

If EXIST "C:\WinHTTP.txt" goto :FINISHED

%systemroot%\regedit.exe /s \\DC-01\netlogon\WinHTTP\WinHttpProxy.reg

echo CopyCompleted >> "C:\WinHTTP.txt"

:FINISHED

exit

Thank you @LeMarchand I've used xcopy to copy over a text file to %appdata% then used the If EXIST command to skip the rest of the cmd file if that text file already exists. There may be a cleaner way to do it but it works :p Thank you all for your help!

Posted (edited)
@thimon, any chance you could share your script?

I am also wanting to remove Edge from the taskbar.

 

@echo OFF

 

If EXIST "%appdata%\text.txt" goto :FINISHED

 

xcopy /f /q /s /a "\\location of file\text.txt" "%appdata%" /E /I

 

DEL /F /S /Q /A "%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*"

 

REG DELETE HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband /F

 

taskkill /f /im explorer.exe

 

start explorer.exe

 

:FINISHED

 

exit

 

 

It also removes File Explorer, which they can either re-pin or access via the Start Menu. If anyone wants to pass judgment on this that's fine! :)

Edited by thimon
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...