What is a best way to implement cancelation of PowerShell script?


i have case when should cancel of execution of powershell script outside. couldn’t break/kill process because script should rollback/commit state. best way this?

i found can send ctrl+c console , handle in blocks. considered powershell’s transaction, didn’t find way create powershell script.

thanks!




you use: break,throw,return,exit depending on want  to achieve. check these links the behavior of these commands:

break: http://technet.microsoft.com/en-us/library/hh847873.aspx

throw:http://technet.microsoft.com/en-us/library/hh847766.aspx

return: http://technet.microsoft.com/en-us/library/hh847760.aspx


jaap brasser
http://www.jaapbrasser.com



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Motherboard replacement

Cannot create Full Text Search catalog after upgrading to V12 - Database is not fully started up or it is not in an ONLINE state

Remote Desktop App - Error 0x207 or 0x607