I'm running 64bit Powershell ISE on Windows Server 2008r2.
While debugging I set a variable like:
$dbName = "db1"
I then make the following change
$dbName = "db2"
I step through the script again and even though the debugger steps over the amended line, when I then hover over the $dbName variable it still shows a value of "db1". The only way I can seem to work around this is to restart that ISE - which is a pain!
Can anyone tell me where I'm going wrong please?
* Update *
I have the following function in a module:
Function SampleFunction()
{
$dbName = "db1"
write-host $dbName
}
I have a powershell script that imports the moduleL
Import-Module -Name ".\BadPsm.psm1"
From the powershell ISE I place a breakpoint on $dbName = "db1" before executing the function by entering "SampleFunction" in the execution window. All is good and the value "db1" is written to the output window.
I then change the function so that $dbName = "db2". I re-import the module by executing Import-Module -Name ".\BadPsm.psm1" again.
When I execute the function again I hit the breakpoint, step over and can see that $dbName still equals "db1", "db1" is also written to the output window.
In order to help illustrate I've posted a short screencast to youtube here: youtube link