thimon Posted January 12, 2017 Posted January 12, 2017 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
LeMarchand Posted January 12, 2017 Posted January 12, 2017 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! 1
thimon Posted January 12, 2017 Author Posted January 12, 2017 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
LeMarchand Posted January 12, 2017 Posted January 12, 2017 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 1
Arthur Posted January 13, 2017 Posted January 13, 2017 If you already customise the layout of the Start Menu it wouldn't take much more effort to do the same with the taskbar... www.edugeek.net/forums/windows-10/173327-configure-windows-10-taskbar-new-anniversary-update-feature.html
Geoff Posted January 13, 2017 Posted January 13, 2017 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
thimon Posted January 13, 2017 Author Posted January 13, 2017 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 Thank you all for your help!
Chuckster Posted January 13, 2017 Posted January 13, 2017 @thimon, any chance you could share your script? I am also wanting to remove Edge from the taskbar.
thimon Posted January 13, 2017 Author Posted January 13, 2017 (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 January 13, 2017 by thimon 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now