Run the following commands to restart a PowerShell session:
Note |
---|
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. |
Code Block | ||
---|---|---|
| ||
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)") } |