I have a script called Restart-Audio.ps1
Stop-Process -Confirm -Name musicapp*
Stop-Service audiosrv
Stop-Service AudioEndpointBuilder
Start-Service audiosrv
Invoke-Item C:\path\to\music\app.exe
Every time I start a new PowerShell session, I want this script to run when I type "Restart-Audio" like a normal cmdlet. When I tried to add this to my PowerShell profile, it tried to run the script, asking for the confirmation to stop the processes. I don't want it to run as soon as a PowerShell session starts; I want the command to run when I tell it to.
Thanks.