Restart PowerShell

Run the following commands to restart a PowerShell session: 

This will create a new PowerShell session and any existing objects will not be preserved. This may be required after updating or removing installed modules.

If ([System.Diagnostics.Process]::GetProcessesByName('servercoreshell')) { Exit } Else { $Process = [System.Diagnostics.Process]::GetCurrentProcess(); Start-Process -FilePath $Process.Path -ArgumentList ("-NoExit", "Stop-Process -Id $($Process.Id)") }

Â