clem995
clem995

Reputation: 319

new PowerShell code does not get executed | Visual Studio Code

I have a really wierd problem when I write a PowerShell script using Visual Studio Code.
After I finish executing my script I make some changes to the script, but when I start the script again, these changes do not get executed. I thought maybe I have to little RAM, but I use a Lenovo T570 with 8GB.
Also sometimes during debugging my script I get a error message which says: PowerShell terminated unexpectedly.

does anyone have any idea what the problem might be?
I use VS Code 1.30 and the latest PowerShell Add-In

Upvotes: 0

Views: 114

Answers (1)

Theo
Theo

Reputation: 61068

If the Powershell script is using a module that you have changed, these changes will not take effect once that module was already loaded into memory.

You can try and force the updated module to reload by adding

Remove-Module xxx 

before importing it with

Import-Module xxx 

You can also try using the -Force parameter on the Import-Module cmdlet:

Import-Module xxx -Force

Upvotes: 2

Related Questions