Tech Community Live: Endpoint Manager edition
Jul 21 2022, 08:00 AM - 12:00 PM (PDT)
SOLVED

Audit CMBaselineDeployment EvaluationSchedule

%3CLINGO-SUB%20id%3D%22lingo-sub-3299418%22%20slang%3D%22en-US%22%3EAudit%20CMBaselineDeployment%20EvaluationSchedule%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3299418%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20guys%2C%3CBR%20%2F%3Edoes%20anyone%20have%20a%20method%20to%20display%20the%20Baseline%20deployment%20%22EvaluationSchedule%22%20in%20a%20readable%20format%20or%20list%3F%3CBR%20%2F%3ELike%20the%20%22Get-CMPackageDeployment%20-Name%20%22Deployment%20Test%22%20%7C%20Select-Object%20PackageID%2C%20ProgramName%2C%20CollectionID%2C%20AssignedSchedule%22%20but%20in%20%22Get-CMBaselineDeployment%20-Fast%20-Name%20%22Baseline1%22%20%7C%20Select-Object%20AssignmentName%2CEvaluationSchedule%22.%3CBR%20%2F%3EMaybe%20a%20chance%20with%20an%20SQL%20query%3F%3CBR%20%2F%3EThe%20current%20output%20always%20show%20an%20encrypted%20string.%3CBR%20%2F%3ENeed%20that%20to%20Audit%20an%20Optimize%20the%20Deployments%20to%20not%20overlap.%26nbsp%3B%3CBR%20%2F%3ERegards.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3299418%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECM%20current%20branch%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3301172%22%20slang%3D%22en-US%22%3ERe%3A%20Audit%20CMBaselineDeployment%20EvaluationSchedule%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3301172%22%20slang%3D%22en-US%22%3E%3CP%3EFound%20another%20Function%20for%20a%20little%20bit%20more%20comfortable%20conversion...%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FPSCCMClient%2F0.2.2%2FContent%2FPublic%255CConvertFrom-CCMSchedule.ps1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EConvertFrom-CCMSchedule.ps1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E...with%20additional%20rows.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EFunction%20ConvertFrom-CCMSchedule%20%7B%0A...%23%20insert%20from%20https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FPSCCMClient%2F0.2.2%2FContent%2FPublic%255CConvertFrom-CCMSchedule.ps1%0A%7D%0A%0A%24Baselines%20%3D%20Get-WmiObject%20-class%20SMS_BaselineAssignment%20-namespace%20%22root%5CSMS%5Csite_%24sitecode%22%20%0A%0AForeach%20(%24Baseline%20in%20%24Baselines)%20%7B%0A%20%20%20%20%20%20%20%20%5Bpscustomobject%5D%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Baseline%20%3D%20%24Baseline.AssignmentName%0A%20%20%20EvaluationSchedule%20%3D%20ConvertFrom-CCMSchedule%20-ScheduleString%20%24Baseline.EvaluationSchedule%20%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%22sample.PNG%22%20style%3D%22width%3A%20800px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F368783iAEA33DA68A618C3B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22sample.PNG%22%20alt%3D%22sample.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%20G.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3300516%22%20slang%3D%22en-US%22%3ERe%3A%20Audit%20CMBaselineDeployment%20EvaluationSchedule%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3300516%22%20slang%3D%22en-US%22%3E%3CP%3Eif%20someone%20needs%20the%20result...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EQuery%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EGet-WmiObject%20-class%20SMS_BaselineAssignment%20-namespace%20%22root%5CSMS%5Csite_%24Sitecode%22%20%7C%20Select-Object%20-ExpandProperty%20EvaluationSchedule%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3E%3CBR%20%2F%3EOutput%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EEvaluationSchedule%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E------------------%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E0073CCC0001F2000%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E00D77CC000100008%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E00D4AC8000100600%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E00D77CC000100008%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3E02D77CC000231400%3CBR%20%2F%3E%3C%2FEM%3E...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20Objects%20are%20CM%20Schedule%20Strings%20and%20can%20be%20converted%20with....%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EConvert-CMSchedule%20-ScheduleString%20%22%26lt%3B%20your%20scheduled%20string%20%26gt%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20example%3A%3C%2FP%3E%3CP%3EConvert-CMSchedule%20-ScheduleString%20%220073CCC0001F2000%22%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ESmsProviderObjectPath%20%3A%20SMS_ST_RecurWeekly%3CBR%20%2F%3EDay%20%3A%207DayDuration%20%3A%200%3CBR%20%2F%3EForNumberOfWeeks%20%3A%201%3CBR%20%2F%3EHourDuration%20%3A%200%3CBR%20%2F%3EIsGMT%20%3A%20False%3CBR%20%2F%3EMinuteDuration%20%3A%200%3CBR%20%2F%3EStartTime%20%3A%2012%2F19%2F2021%203%3A00%3A00%20AM%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFound%20also%20a%20Function%20to%20grab%20it%20at%20once%3A%26nbsp%3B%3CA%20title%3D%22Convert%20SCCM%20schedule%20to%20readable%20format%22%20href%3D%22https%3A%2F%2Fxenit.se%2Fblog%2F2017%2F04%2F18%2Fconvert-sccm-schedule-readable-format%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EConvert%20SCCM%20schedule%20to%20readable%20format%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EFunction%20ConvertFrom-CMSchedule%0A%7B%0A....%0A%7D%0A%0A%24Baselines%20%3D%20Get-WmiObject%20-class%20SMS_BaselineAssignment%20-namespace%20%22root%5CSMS%5Csite_%24Sitecode%22%20%7C%20Select-Object%20AssignmentName%2CEvaluationSchedule%0A%0AForeach%20(%24Baseline%20in%20%24Baselines)%20%7B%0A%20%23%24Schedule%20%3D%20Get-WmiObject%20-class%20SMS_BaselineAssignment%20-namespace%20%22root%5CSMS%5Csite_%24Sitecode%22%20%7C%20Select-Object%20-ExpandProperty%20EvaluationSchedule%20%7C%20ConvertFrom-CMSchedule%0A%20%20%20%20%20%20%20%20%5Bpscustomobject%5D%40%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Baseline%20%3D%20%24Baseline.AssignmentName%0A%20%20%20%20%20%20%20%20%20%20%20%20EvaluationSchedule%20%20%3D%20%24Baseline%20%7C%20Select-Object%20-ExpandProperty%20EvaluationSchedule%20%7C%20ConvertFrom-CMSchedule%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%20Geraldo%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi guys,
does anyone have a method to display the Baseline deployment "EvaluationSchedule" in a readable format or list?
Like the "Get-CMPackageDeployment -Name "Deployment Test" | Select-Object PackageID, ProgramName, CollectionID, AssignedSchedule" but in "Get-CMBaselineDeployment -Fast -Name "Baseline1" | Select-Object AssignmentName,EvaluationSchedule".
Maybe a chance with an SQL query?
The current output always show an encrypted string.
Need that to Audit an Optimize the Deployments to not overlap. 
Regards.

2 Replies

if someone needs the result...

 

Query:

 

Get-WmiObject -class SMS_BaselineAssignment -namespace "root\SMS\site_$Sitecode" | Select-Object -ExpandProperty EvaluationSchedule

 


Output:

EvaluationSchedule
------------------
0073CCC0001F2000
00D77CC000100008
00D4AC8000100600
00D77CC000100008
02D77CC000231400
...

 

This Objects are CM Schedule Strings and can be converted with....

 

Convert-CMSchedule -ScheduleString "< your scheduled string >

 

 

For example:

Convert-CMSchedule -ScheduleString "0073CCC0001F2000"


SmsProviderObjectPath : SMS_ST_RecurWeekly
Day : 7DayDuration : 0
ForNumberOfWeeks : 1
HourDuration : 0
IsGMT : False
MinuteDuration : 0
StartTime : 12/19/2021 3:00:00 AM

 

 

Found also a Function to grab it at once: Convert SCCM schedule to readable format 

 

 

Function ConvertFrom-CMSchedule
{
....
}

$Baselines = Get-WmiObject -class SMS_BaselineAssignment -namespace "root\SMS\site_$Sitecode" | Select-Object AssignmentName,EvaluationSchedule

Foreach ($Baseline in $Baselines) {
	#$Schedule = Get-WmiObject -class SMS_BaselineAssignment -namespace "root\SMS\site_$Sitecode" | Select-Object -ExpandProperty EvaluationSchedule | ConvertFrom-CMSchedule
        [pscustomobject]@{
            Baseline = $Baseline.AssignmentName
            EvaluationSchedule  = $Baseline | Select-Object -ExpandProperty EvaluationSchedule | ConvertFrom-CMSchedule
        }
    }

 

 

Regards, Geraldo

best response confirmed by Geraldo (Occasional Contributor)
Solution

Found another Function for a little bit more comfortable conversion...

ConvertFrom-CCMSchedule.ps1 

...with additional rows.

Function ConvertFrom-CCMSchedule {
...# insert from https://www.powershellgallery.com/packages/PSCCMClient/0.2.2/Content/Public%5CConvertFrom-CCMSchedule.ps1
}

$Baselines = Get-WmiObject -class SMS_BaselineAssignment -namespace "root\SMS\site_$sitecode" 

Foreach ($Baseline in $Baselines) {
        [pscustomobject]@{
            Baseline = $Baseline.AssignmentName
			EvaluationSchedule = ConvertFrom-CCMSchedule -ScheduleString $Baseline.EvaluationSchedule 
        }
    }


sample.PNG

 

Regards, G.