none
trap command in powershell RRS feed

  • Question

  • hello, 

    i have script that want users when script run can not terminate it with ctrl+c like trap command in linux also i want ignore signal interrupt any way and user when want try use ctrl+c prompt to enter password 

    $password ="soheil"
    $pass = Read-Host -AsSecureString -Prompt "Enter preshared key:" 
    if ( $password -ne $pass ){

    logoff

    else 

    powershell}

    please advise me to complete my script

    regards 



    Wednesday, July 9, 2014 6:31 PM