In Task Scheduler, how may I stop a running task sooner than 1 hour, say immediately after execution?
I've tried manually entering '1 minute', but the Task is still 'running'. Suggestions?
I'm running a powershell script via Task to unlock my vault during backup tasks.. Maybe there's a means of closing its window so the task can actually End?
Here's my original PS:
$SecureString = ConvertTo-SecureString "111111111111" -AsPlainText -Force
Unlock-BitLocker -MountPoint "G:" -Password $SecureString
Here's my bat creator code...
function Convert-PowerShellToBatch
{
param
(
[Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)]
[string]
[Alias("FullName")]
$Path
)
process
{
$encoded = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes((Get-Content -Path $Path -Raw -Encoding UTF8)))
$newPath = [Io.Path]::ChangeExtension($Path, ".bat")
"@echo off`npowershell.exe -NoExit -encodedCommand $encoded" | Set-Content -Path $newPath -Encoding Ascii
}
}
Get-ChildItem -Path D:\Scripts\vault-unlock.ps1 |
Convert-PowerShellToBatch