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

Problem with StartDate and EndDate in Set-DbaAgentSchedule #4908

Closed
dylan-azucena opened this issue Jan 4, 2019 · 0 comments · Fixed by #5115
Closed

Problem with StartDate and EndDate in Set-DbaAgentSchedule #4908

dylan-azucena opened this issue Jan 4, 2019 · 0 comments · Fixed by #5115

Comments

@dylan-azucena
Copy link

Steps to Reproduce

Set-DbaAgentSchedule -SqlInstance db1 -Job "Test 01" -ScheduleName "Daily" -StartDate "20190102" -EndDate "99991231"

Expected Behavior

Should update the indicated schedule with the given start and end date.

Actual Behavior

Getting these errors:

The property 'StartDate' cannot be found on this object. Verify that the property exists and can be set.
At line:83682 char:29
+                             $JobSchedule.StartDate = $StartDate
+                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException

The property 'EndDate' cannot be found on this object. Verify that the property exists and can be set.
At line:83687 char:29
+                             $JobSchedule.EndDate = $EndDate
+                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException

It looks like this is because the function is using incorrect field names StartDate and EndDate. From SMO documentation it appears they should be ActiveStartDate and ActiveEndDate.

Environmental data

  • dbatools:
    0.9.730
  • PowerShell:
Name                           Value
----                           -----
PSVersion                      6.1.1
PSEdition                      Core
GitCommitId                    6.1.1
OS                             Darwin 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
  • SQL Server:
Microsoft SQL Server 2017 (RTM-CU5) (KB4092643) - 14.0.3023.8 (X64) 
	Mar  2 2018 18:24:44 
	Copyright (C) 2017 Microsoft Corporation
	Standard Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor)
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