Looks like an issue with the Get-Service cmdlet which in turn affects the 
win_service Ansible module. I've raised a bug for this 
https://github.com/ansible/ansible/issues/37621.

You can test it out by just trying to run in PowerShell manually

Get-Service -Name 'SAS [config-Lev1] SASMeta - Metadata Server'

This shouldn't return anything as that cmdlet is interpreting the [] chars 
as a string modifier instead of a string literal.

To get the stat side of win_service working you just need to change the 
lines

https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/windows/win_service.ps1#L60
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/windows/win_service.ps1#L389

to

$svc = Get-Service | Where-Object { $_.Name -eq $name }

It looks like this will allow you to get the service details back but it 
will probably fail when trying to stop and start it as I see some other 
**-Service* cmdlets being used with the *-Name *parameter. The foolproof 
way to get it all working is to no work with a service with those chars but 
that may be hard to do in your environment.

Hopefully we should have a fix in soon for this.

Thanks

Jordan

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6bff3dec-b4cf-4c7c-af90-2d27a5e44865%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to