The SharePoint snap-in needs to be loaded before you can execute commands against the SharePoint object model. This snap-in is automatically loaded for you by the SharePoint Management Shell. But the SharePoint management shell does not offer many of the advantages that PowerShell ISE offers (like debugging with breakpoints, etc). To get PowerShell ISE to autoload the SharePoint snap-in, follow the steps in this article.
A while ago, I noticed a peculiar behavior with one of my custom SharePoint workflows. Tasks were getting locked out after the first edit. The first edit proceeds fine but when we attempt to edit the task a second time, we get an error like this:
This task is currently locked by a running workflow and cannot be edited.