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

[Bug] Start-DbaXESession -StopAt date formatting error between UK/US style #6483

Closed
1 task
ap-tnt opened this issue Apr 21, 2020 · 2 comments · Fixed by #6782
Closed
1 task

[Bug] Start-DbaXESession -StopAt date formatting error between UK/US style #6483

ap-tnt opened this issue Apr 21, 2020 · 2 comments · Fixed by #6782
Assignees

Comments

@ap-tnt
Copy link

ap-tnt commented Apr 21, 2020

Environmental information

#### PowerShell version:

Name                           Value                                                                                                                                                                        
----                           -----                                                                                                                                                                        
PSVersion                      5.1.17134.858                                                                                                                                                                
PSEdition                      Desktop                                                                                                                                                                      
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                      
BuildVersion                   10.0.17134.858                                                                                                                                                               
CLRVersion                     4.0.30319.42000                                                                                                                                                              
WSManStackVersion              3.0                                                                                                                                                                          
PSRemotingProtocolVersion      2.3                                                                                                                                                                          
SerializationVersion           1.1.0.1                                                                                                                                                                      




#### dbatools Module version:


Name    : dbatools
Path    : C:\Program Files\WindowsPowerShell\Modules\dbatools\dbatools.psd1
Version : 1.0.106




SQL Server:

Microsoft SQL Server 2017 (RTM-GDR) (KB4505224) - 14.0.2027.2 (X64) Jun 15 2019 00:26:19 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Enterprise 10.0 (Build 17134: ) (Hypervisor)

Report

When attempting to use Start-DbaXESession with a -StopAt (get-date).AddMinutes(10), I get the following error:

WARNING: [15:31:59][New-DbaAgentSchedule] Start date 04/21/2020 15:41:56 needs to be a valid date with format yyyyMMdd

Please note that I am in the UK, and so I would expect the start date to be passed in 21/04/2020 rather than 04/21/2020 as referenced in the error message. Also, I have replaced the name of my computer with MYCOMPUTERNAME, as I don't think my employer would like it if I put the real one on there!

Host used

  • [x ] powershell.exe
  • [x ] ISE
  • [x ] VS Code
  • Other (please specify)

If anything other than powershell.exe was used, please confirm that you can duplicate the issue with powershell.exe

  • [x ] Still buggy in powershell.exe

Errors Received



writeErrorStream      : True
PSMessageDetails      : 
Exception             : System.Exception: Start date 04/21/2020 15:41:56 needs to be a valid date with format yyyyMMdd
TargetObject          : MYCOMPUTERNAME\sql2017
CategoryInfo          : NotSpecified: (MYCOMPUTERNAME\sql2017:DbaInstanceParameter) [Write-Error], Exception
FullyQualifiedErrorId : dbatools_New-DbaAgentSchedule,Stop-Function
ErrorDetails          : Start date 04/21/2020 15:41:56 needs to be a valid date with format yyyyMMdd
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at Stop-Function, C:\Program Files\WindowsPowerShell\Modules\dbatools\allcommands.ps1: line 82910
                        at New-DbaAgentSchedule<Begin>, C:\Program Files\WindowsPowerShell\Modules\dbatools\allcommands.ps1: line 49560
                        at New-StopJob, C:\Program Files\WindowsPowerShell\Modules\dbatools\allcommands.ps1: line 67639
                        at Start-DbaXESession<Process>, C:\Program Files\WindowsPowerShell\Modules\dbatools\allcommands.ps1: line 67671
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}

Steps to Reproduce

Get-DbaXESessionTemplate -Template 'long running queries' | Import-DbaXESessionTemplate -SqlInstance localhost\sql2017

Start-DbaXESession -SqlInstance localhost\sql2017 -Session 'long running queries' -StopAt (get-date).AddMinutes(10)

Note: I suspect that this would have to be run on a computer with local settings set to UK in order to reproduce.

Expected Behavior

  1. 'long running queries' XE Session imported
  2. 'long running queries' XE Session started
  3. SQL Agent job called "XE Session Stop - Long Running Queries" should be created, with correct job step.
  4. "XE Session Stop - Long Running Queries" SQL agent job should have a schedule set to run 10 minutes from now.

Actual Behavior

  1. 'long running queries' XE Session imported
  2. 'long running queries' XE Session started
  3. SQL Agent job called "XE Session Stop - Long Running Queries" was created, with correct job step.
  4. "XE Session Stop - Long Running Queries" did not have a schedule, so it wouldn't ever run.
@stale
Copy link

stale bot commented Jun 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. If you would like this issue to remain open:

  • Verify that you can still reproduce the issue in the latest version of dbatools
  • Comment that the issue is still reproducible and include:
    • What version of dbatools you reproduced the issue on
    • What OS and version you reproduced the issue on
    • What steps you followed to reproduce the issue

@stale stale bot added the stale Stale Bot label used to identify issues that are no longer active and bot has closed them label Jun 20, 2020
@ap-tnt
Copy link
Author

ap-tnt commented Jun 22, 2020

Hi
I have reproduced this issue. All the details are the same above, apart from the version of DBATools, which is now:

1.0.112

@stale stale bot removed the stale Stale Bot label used to identify issues that are no longer active and bot has closed them label Jun 22, 2020
@niphlod niphlod self-assigned this Aug 31, 2020
niphlod added a commit to niphlod/dbatools that referenced this issue Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants