Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Strange errors when executing PowerShell scripts

63 views
Skip to first unread message

Simone Bianchelli

unread,
Dec 16, 2024, 4:06:03 AM12/16/24
to rundeck-discuss
Hello, i have Rundeck installed and running on a Windows Server 2019 VM, when i execute some PowerShell scripts with target Windows nodes, i get the following errors:

C:\rundeck\libext\cache\py-winrm-plugin-2.1.3\common.py:35: SyntaxWarning: invalid escape sequence '\s'
  regexpMultipleAbsolutePath = re.compile('\'[a-zA-Z]:\\\\.*\s[a-zA-Z]:\\\\.*') #at least two absolute paths
C:\rundeck\libext\cache\py-winrm-plugin-2.1.3\common.py:39: SyntaxWarning: invalid escape sequence '\s'
  regexpPathAndOption = re.compile('\'[a-zA-Z]:\\\\.*\s/.+')
C:\rundeck\libext\cache\py-winrm-plugin-2.1.3\common.py:43: SyntaxWarning: invalid escape sequence '\s'
  regexpPathAndOptionUnix = re.compile('\'[a-zA-Z]:\\\\.*\s-.+')
C:\rundeck\libext\cache\py-winrm-plugin-2.1.3\common.py:47: SyntaxWarning: invalid escape sequence '\s'
  regexPathRequireQuotes = re.compile('\'[a-zA-Z]:\\\\.*\s')

However the job complete OK and the script does what i need, how can i remove these errors appearing on the output?

Thanks in advice.

rac...@rundeck.com

unread,
Dec 16, 2024, 6:56:01 AM12/16/24
to rundeck-discuss
Hi,

Can you share an example Powershell script when this occurs? (Just a reproducible example). Probably this deserves a new issue here.

Regards!

Simone Bianchelli

unread,
Dec 16, 2024, 7:20:47 AM12/16/24
to rundeck-discuss
Sure!

It's a simple script that restart a given Windows service, here is the script:

if (Get-Service -Name "@option.servizio@") {
$arrService = Get-Service -Name "@option.servizio@"
Restart-Service -Name "@option.servizio@"
write-host 'Restarting service @option.servizio@'

Start-Sleep -seconds 10

$arrService.Refresh()

if ($arrService.Status -eq 'Running')
{
    Write-Host '@option.servizio@ is now running'
} else {
    Write-Host '@option.servizio@ is stopped, notifying...'
    exit 1
}

} else {
    Write-Host "@option.servizio@ service doesn't exists."
}

the option servizio has the following list of allowed values: NETA Schedulatore Amministratore Service,NETABollengWrapperService,Neta Etl Service,NETA Reports Service,NETA OutputFile Service

Best regards.

rac...@rundeck.com

unread,
Dec 16, 2024, 9:12:54 AM12/16/24
to rundeck-discuss
It seems related to Python-specific versions (take a look at this). Which Python version are you using in your Rundeck instance? Probably the plugin needs an update to avoid these warnings.

Regards.

Simone Bianchelli

unread,
Dec 16, 2024, 9:21:38 AM12/16/24
to rundeck-discuss
Thanks for the anwser,
Python version is v3.12.3, py-winrm plugin is v2.1.3 which i see is the last available on GitHub https://github.com/rundeck-plugins/py-winrm-plugin

Best.

Simone Bianchelli

unread,
Dec 17, 2024, 12:44:59 PM12/17/24
to rundeck-discuss
I upgraded Python to latest version 3.13.1 but these errors still showing on the output.

rac...@rundeck.com

unread,
Dec 17, 2024, 4:25:07 PM12/17/24
to rundeck-discuss
Yeah, that issue is related to the latest Python versions, and the plugin would need an update. Test using Python 3.10.

Greetings.


Simone Bianchelli

unread,
Dec 18, 2024, 11:05:40 AM12/18/24
to rundeck-discuss
Thanks, i think i will wait the plugin update, i opened an issue on GitHub. Meanwhile i can stay with the actual Python version as however it doesn't cause the job to fail.

Best.

Reply all
Reply to author
Forward
0 new messages