Forum Discussion

Geraldo's avatar
Geraldo
Copper Contributor
Apr 30, 2022
Solved

Audit CMBaselineDeployment EvaluationSchedule

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.

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

    https://www.powershellgallery.com/packages/PSCCMClient/0.2.2/Content/Public%5CConvertFrom-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 
            }
        }


     

    Regards, G.

     

2 Replies

  • Geraldo's avatar
    Geraldo
    Copper Contributor

    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: https://xenit.se/blog/2017/04/18/convert-sccm-schedule-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

    • Geraldo's avatar
      Geraldo
      Copper Contributor

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

      https://www.powershellgallery.com/packages/PSCCMClient/0.2.2/Content/Public%5CConvertFrom-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 
              }
          }


       

      Regards, G.

       

Resources