To manage auto starting programs on Windows, don’t bother writing extensive scripts. PowerShell can directly open the autostart manager included in task manager which does all you need:
PS C:\> Taskmgr /7 /startup
This opens a window and lists all auto starting programs, along with their impact on the launch time. To keep any one of these programs from automatically starting, click a program in the list, then click the button “Disable” in the lower right corner.
If you like, turn the command into a function and place it into your profile script should you need to fiddle with autostarts more often:
function Show-Autostart { Taskmgr /7 /startup }