Skip to content

Running Posh-Acme as system via scheduledTask throws an exception #628

@blackops786187

Description

@blackops786187

Hi,

In order to automate the creation of the certificates, i created a scheduled task which runs as NT system (stops any powershell GUI popup) running the below script. When invoking the task, the script terminates with an error but if i run the script using my standard local account, it works fine.

I have attached a transcript of the script. Im running Windows 11 24h2 with the 4.29.1 Posh-Acme module.
https://github.com/user-attachments/files/20942303/Log.system.txt

Start-Transcript -Force -Path $PSScriptRoot\Log.txt
$ErrorActionPreference = "Stop"
$VerbosePreference = "Continue"
$DebugPreference = "Continue"

$pArgs = @{
    DuckToken  = ConvertTo-SecureString 'TOKENREDACTED' -AsPlainText -Force
    DuckDomain = 'Blackops321'
}

New-PACertificate 'blackops321.duckdns.org' -UseSerialValidation -Plugin DuckDNS -PluginArgs $pArgs -Verbose -ValidationTimeout 300 -Force -AcceptTos | ForEach-Object {
    Copy-Item -Path $_.CertFile -Destination (Split-Path $PSScriptRoot) -Force
    Copy-Item -Path $_.KeyFile -Destination (Split-Path $PSScriptRoot) -Force
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions