V4.0.6 or V4.0.5 Stop-ServiceAndDependencies - ignored it if no service was present

No matter how I try, if the service is not present during a new installation, it gives an error, what am I doing wrong -SkipDependentServices?
-SkipDependentServices

#V3 Stop-ServiceAndDependencies -Name ‘TeamViewer’ from V3 ignored it if no service was present

Choose to skip checking for and stopping dependent services

# Stop-ADTServiceAndDependencies -Service 'TeamViewer'
# Stop-ADTServiceAndDependencies -Service 'TeamViewer' -SkipDependentServices $true
# Stop-ADTServiceAndDependencies -Service 'TeamViewer' -SkipDependentServices $false
# Stop-ADTServiceAndDependencies -Service 'TeamViewer' -SkipDependentServices

My Solution:
if (Get-Service -Name ‘TeamViewer’ -ErrorAction SilentlyContinue)
{
Stop-Service -Name ‘TeamViewer’
Write-ADTLogEntry -Message “TeamViewer-Dienst wurde gestoppt.”
} else {Write-ADTLogEntry -Message “TeamViewer-Dienst ist nicht vorhanden.”}

I’m sure @mjr4077au can confirm, but I believe what you are seeing may be this bug that was resolved very recently

2 Likes

Thanks @Adrian_Scott, that’s correct. Apologies for this!

ItWasMeGIF

1 Like

thanks, but I also tested with 4.0.6, same error