Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resetting the session in PowerShell

When I change a setting in my PowerShell profile, I am closing the PowerShell window and reopening it to reset the session.

I assume there is a better command or cmdlet to refresh the session. Any clue?

like image 937
tugberk Avatar asked Aug 31 '11 08:08

tugberk


People also ask

How do you refresh a session in PowerShell?

Use the Update-SessionEnvironment command to refresh the current PowerShell session with all environment settings possibly performed by Chocolatey package installs.

How do I restart a PowerShell session in Linux?

The idea is if you are in ISE, it will restart ISE. If you are in plain PowerShell, it will restart plain PowerShell. Get-PSHostProcessInfo returns information about the current PowerShell session which allows you to determine whether or not you are running ISE or not.

How do you delete a session in PowerShell?

To delete all the PSSessions in the current session, type Get-PSSession | Remove-PSSession . A PSSession uses a persistent connection to a remote computer. Create a PSSession to run a series of commands that share data.

How do you restart a service in PowerShell?

You can restart a windows service by using the Powershell cmdlet Restart-Service. Here, the parameter -PassThru force the command to wait until the service get restarted completed and displays its running status.


1 Answers

You can just dotsource your profile.

. $Profile

If your profile handles errors when things like drives, or vars even exists, everything is ok.

like image 141
JPBlanc Avatar answered Oct 06 '22 10:10

JPBlanc