Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function Start-SqlAgent in "allcommands.ps1" at line 77188 #5210

Closed
matthiaseckerle opened this issue Mar 16, 2019 · 4 comments
Closed

function Start-SqlAgent in "allcommands.ps1" at line 77188 #5210

matthiaseckerle opened this issue Mar 16, 2019 · 4 comments

Comments

@matthiaseckerle
Copy link

On a german (DE-de) system there is no service like "SQL Server Agent", it is instead "SQL Server-Agent". Notice the f*cking hyphen.

Steps to Reproduce

Remove-DbaDatabaseSafely -SqlInstance . -Database Test -BackupFolder c:\temp

Output from Remove-DbaDatabaseSafely (with error message)
Get-Service : Es kann kein Dienst mit dem Anzeigenamen "SQL Server Agent (MSSQLSERVER)" gefunden werden.
In C:\Program Files\WindowsPowerShell\Modules\dbatools\0.9.784\allcommands.ps1:77194 Zeichen:37
+ ... ntservice = Get-Service -ComputerName $ipaddr -DisplayName $serviceNa ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (SQL Server Agent (MSSQLSERVER):String) [Get-Service], 
ServiceCommandException
    + FullyQualifiedErrorId : NoServiceFoundForGivenDisplayName,Microsoft.PowerShell.Commands.GetServiceCommand
Get-Service : Es kann kein Dienst mit dem Anzeigenamen "SQL Server Agent (MSSQLSERVER)" gefunden werden.
In C:\Program Files\WindowsPowerShell\Modules\dbatools\0.9.784\allcommands.ps1:77194 Zeichen:37
+ ... ntservice = Get-Service -ComputerName $ipaddr -DisplayName $serviceNa ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (SQL Server Agent (MSSQLSERVER):String) [Get-Service], ServiceCommandException
    + FullyQualifiedErrorId : NoServiceFoundForGivenDisplayName,Microsoft.PowerShell.Commands.GetServiceCommand

PS>TerminatingError(): "Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat."
WARNUNG: [08:34:35][Remove-DbaDatabaseSafely] Failure starting SQL Agent | Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat.

Expected Behavior

Get service state of service named "SQL Server Agent"

Actual Behavior

There is no service named "SQL Server Agent"

Output from Get-Service SQL*
Status : Running
Name : SQLAgent$SQL2017
DisplayName : SQL Server-Agent (SQL2017)

Status : Stopped
Name : SQLBrowser
DisplayName : SQL Server-Browser

Status : Running
Name : SQLSERVERAGENT
DisplayName : SQL Server-Agent (MSSQLSERVER)

Status : Stopped
Name : SQLTELEMETRY
DisplayName : SQL Server CEIP service (MSSQLSERVER)

Status : Stopped
Name : SQLTELEMETRY$SQL2017
DisplayName : SQL Server CEIP service (SQL2017)

Status : Running
Name : SQLWriter
DisplayName : SQL Server VSS Writer

Environmental data

Output from $host
Name : Windows PowerShell ISE Host
Version : 5.1.17763.316
InstanceId : b09c5fab-1339-4a8e-9660-a276bf9a86e8
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : de-DE
CurrentUICulture : de-DE
PrivateData : Microsoft.PowerShell.Host.ISE.ISEOptions
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace

Output dbatools module version
Major : 0
Minor : 9
Build : 784
Revision : -1
MajorRevision : -1
MinorRevision : -1

Output SQL Instance details (Version and language)
$Instance=Get-DbaInstance -SqlInstance .
$Instance.Version

Major Minor Build Revision
13 0 4522 -1

$Instance.Language
Deutsch (Deutschland)

@wsmelton
Copy link
Member

Is de what the culture is set to on the server as well?

@matthiaseckerle
Copy link
Author

PS C:\WINDOWS\system32> $Culture = Get-Culture
PS C:\WINDOWS\system32> $Culture | Format-List -Property *

Parent                         : de
LCID                           : 1031
KeyboardLayoutId               : 1031
Name                           : de-DE
IetfLanguageTag                : de-DE
DisplayName                    : Deutsch (Deutschland)
NativeName                     : Deutsch (Deutschland)
EnglishName                    : German (Germany)
TwoLetterISOLanguageName       : de
ThreeLetterISOLanguageName     : deu
ThreeLetterWindowsLanguageName : DEU
CompareInfo                    : CompareInfo - de-DE
TextInfo                       : TextInfo - de-DE
IsNeutralCulture               : False
CultureTypes                   : SpecificCultures, InstalledWin32Cultures, FrameworkCultures
NumberFormat                   : System.Globalization.NumberFormatInfo
DateTimeFormat                 : System.Globalization.DateTimeFormatInfo
Calendar                       : System.Globalization.GregorianCalendar
OptionalCalendars              : {System.Globalization.GregorianCalendar}
UseUserOverride                : True
IsReadOnly                     : False

@matthiaseckerle
Copy link
Author

I guess it would be better to use "Name" instead of "Display Name" as the parameter for "Get-Service".
As far as I know only the latter is localized.

@potatoqualitee
Copy link
Member

look at all those dashes! that's wild

potatoqualitee added a commit that referenced this issue Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants