powershell gotchas :- Use global variable / function when you have event in your code


Did you know that its a good idea to use global function and variables when you use event in your code.

Have a look at example below :-



You will not be able to call GetActiveQueueMessage function and your script just dies.

Key take from this is, if you have event, any variable or function you're referring to, please make sure its defined on global or script scope.

Otherwise, you pretty much get uninitialized or empty variable everywhere.







Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm