When writing a powershell script in ISE, I have something similar (which I am running with F5 ):
Function DoSomethingNow { "What am I doing?" } DoSomethingNow
The problem is that if I rename or delete DoSomethingNow , it is still available in the session. This causes confusion that my script will continue to work, while I expect an error in the absence of a function.
I can only assume that I need to clear the session after each debug round, however, it seems that this is only possible when restarting ISE (therefore restarting the powershell session).
So I ask:
- Is it possible to clear a session so that
DoSomethingNow no longer in scope? - What is the “right” way to debug and execute powershell scripts?
- Maybe I'm not using ISE in the right way?
I would appreciate it being directed in the right direction.
source share