Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Resolved PowerShell Visual studio code stuck with 'Starting up PowerShell' in status bar

On one of the my colleagues new laptop we were setting up Visual Studio Code environment. After installing Microsoft PowerShell extension on VSCode when executing PowerShell ps1 script, it was getting stuck/freeze/hang with message "Starting up PowerShell" at the bottom-right side, and it was showing below the popup message.

You have an older version of PackageManagement known to cause issues with the PowerShell extension. Would you like to update PackageManagement (You will need to restart the PowerShell extension after)?
Source: PowerShell (Extension)

Microsoft visual studio code vscode older version of packagemanagement module extension hung freeze stuck starting powershell nolog noprofile pwsh.exe powershell.exe install-module.png

The simple resolution for issue is update PackageManagement module on PowerShell from psgallery, using below one liner command or clicking Yes button on the above popup box.

Get-PSRepository WARNING Unable to find module repositories
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send
How to sign PowerShell ps1 scripts

powershell.exe -NoLogo -NoProfile -Command '[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber -Repository PSGallery'

Visual studio code hung freeze stuck starting powershell in statusbar Powershell.exe Nologo noprofile command net.servicepointemanageer net.securityprotocoltype tls12 install-module packagement psgallery.png

Once PackageManagement updated you will see the below message. Restart VSCode and you will be able to execute PowerShell ps1 scripts as PowerShell is ready for the actions.

PackageManagement updated, if you already had PackageManagement loaded in your session, please restart the Powershell extension.

Useful Articles
Creating an internal PowerShell module repository
GUI - SETUP AND CONFIGURE POWERSHELL WEB ACCESS SERVER (GATEWAY)
USE POWERSHELL ON MOBILE - SETUP AND CONFIGURE POWERSHELL WEB ACCESS (PSWA) 
Different ways to bypass Powershell execution policy :.ps1 cannot be loaded because running scripts is disabled
Powershell Trick : Execute or run any file as a script file
Set Powershell execution policy with Group Policy
Powershell execution policy setting is overridden by a policy defined at a more specific scope

Go Back



Comment

Blog Search

Page Views

11240265

Follow me on Blogarama