Vandrey Trindade replied to the topic Is there a command to stop the running script? in the forum General PowerShell Q&A 1 week ago
Hmmm… Since it’s not possible, that’s ok then…
I have seen this solution elsewhere:
# Test to see if escape was pressed within the loop
} while ( -not ( $Host.UI.RawUI.KeyAvailable -and ($Host.UI.RawUI.ReadKey(“IncludeKeyUp,NoEcho”).VirtualKeyCode -eq 2
7 ) ) ) Write-Host “ok”
If I press the ESC key, it would stop the code and…[Read more]
Thanks for joining!
I’m not trying to do multiple O365 sessions.
I have created a menu so my colleagues can execute some O365 tasks that they aren’t aware how to do it. In that menu they have a lot of options to choose from.
But the problem is, when they start a script, they have to wait until it is finished. If they enter the wrong…[Read more]
Thanks for replying again!
I’m using that approach on the Active Directory menu, when I have cmdlets that need credentials:
Start-Process PowerShell -Credential $ADcred -ArgumentList “-File .DHCP.3-Reservations.ps1”
But the problem is with the Office 365 menu, where I have a session established and I couldn’t find a way to start…[Read more]
I’m sending a new message on this post again…
I have found this code to block the use of CTRL+C on the console session:
[console]::TreatControlCAsInput = $true
Now I’m trying to find a way to create a shortcut for the “break” command.
Have tried using Set-PSReadlineKeyHandler from the PSReadline module, but on version 1.2 it has some…[Read more]