Thursday, May 28, 2015

Script to list out Collection schedules of all collection in SCCM to a output file

Option Explicit

Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objLogFile : Set objLogFile = objFSO.CreateTextFile("Collections.log")

Dim strSourceServer
strSourceServer   = "XXX"
Dim strSourceSiteCode
strSourceSiteCode = "XXX"

Dim objSourceWMIService
Dim AllCollections
Dim objCollection
Dim strCollectionName
Dim strCollectionComment
Dim schedule
Dim schedtype
Dim bolScheduleAvailable
Dim strRecur
Dim strEvery

Set objSourceWMIService = GetObject("winmgmts://" & strSourceServer & "\root\sms\site_" & strSourceSiteCode)

'objLogFile.WriteLine Now & " start "

'Loop trought all collections exsisting on the source server
Set AllCollections = objSourceWMIService.ExecQuery("SELECT * FROM SMS_Collection WHERE NAME NOT LIKE 'All%' AND NAME NOT LIKE 'Root%'")

For Each objCollection In AllCollections
    strCollectionName    = objCollection.Name
    strCollectionComment = objCollection.Comment

    'objLogFile.WriteLine Now & " - Collection  " & objCollection.Name

    Set objCollection = objSourceWMIService.Get("SMS_Collection='" & objCollection.CollectionID & "'" )

    'Get Collection schedule
    On Error Resume Next
    Set schedule = objCollection.RefreshSchedule(0)

    On Error GoTo 0

    If Err.Number = 424 Then
        objLogFile.WriteLine "Collection has no Schedule  " & objCollection.Name
    ElseIf Err.Number <> 0 Then
        objLogFile.WriteLine "An Error (" & Err.Number & ") occured while getting the Update Schedule from " & objCollection.Name
    Else
        'On Error Resume Next
        schedtype = Schedule.Path_.Class

        Select Case (schedtype)
            Case "SMS_ST_RecurInterval"
                If schedule.MinuteSpan <> 0 Then strRecur = "Minute"
                If schedule.HourSpan <> 0 Then strRecur = "Hour"
                If schedule.DaySpan <> 0 Then strRecur = "Day"

                If schedule.MinuteDuration <> 0 Then strEvery = schedule.MinuteDuration
        If schedule.HourDuration <> 0 Then strEvery = schedule.HourDuration
        If schedule.DayDuration <> 0 Then strEvery = schedule.DayDuration

                    bolScheduleAvailable = True
                    objLogFile.WriteLine objCollection.Name & ",Recurr every " & strEvery & " " &  strRecur & ",Starting " & schedule.StartTime

                Case "SMS_ST_RecurWeekly"

                    If schedule.ForNumberOfWeeks <> 0 Then  strRecur = "Weekly"

                    bolScheduleAvailable = True
                    objLogFile.WriteLine objCollection.Name & ",Recurr every " & strRecur & ",Starting " & schedule.StartTime

                Case "SMS_ST_RecurMonthlyByDate"

            If schedule.ForNumberOfMonths <> 0 Then strRecur = "Monthly"
                    bolScheduleAvailable = True
                    objLogFile.WriteLine objCollection.Name & ",Recurr every " & strRecur & ",Starting " & schedule.StartTime
                Case "SMS_ST_RecurMonthlyByWeekday"

                    Token.StartTime = schedule.StartTime
                    objLogFile.WriteLine Now & " - SMS_ST_RecurMonthlyByWeekday Schedule available " & objCollection.Name

                    bolScheduleAvailable = True

                Case "SMS_ST_NonRecurring"

                    bolScheduleAvailable = True
                    objLogFile.WriteLine Now & " - SMS_ST_NonRecurring Schedule available " & objCollection.Name

                Case Else
                    bolScheduleAvailable = False
                    objLogFile.WriteLine Now & " - Unknown Schedule (skipping) " & objCollection.Name
            End Select

        End If

    Next

    objLogFile.WriteLine Now & " - Finish"
    WScript.Echo "Done"

Customize the CM2012 console

This is how you can customize the CM2012 console.
Suppose you want the Description field to be always next to the DP name, in Administration workspace, Distribution points node.

Go to %ConfigMgrInstallPath%\AdminConsole\Bin.  Locate and open AdminUI.ConsoleBuilder.exe

Click on File > Open > ConnectedConsole
  

 The ConnectedConsole view will load.  Notice at the bottom left corner, you will see "text" representation of the ConfigMgr 2012 console workspaces.

 

On Left handside, click on Overview/Distribution Points

On Right side, click on Views tab, Edit.
 

Click Configure










In the Property Display Items section, under Class Properties, you can moved the fields up or down as you want.







Close the reopen you CM2012 Console.

Install Active Directory tools on Windows 7

First download RSAT for Windows 7.

The Remote Server Administration Tools (RSAT) for Windows 7 can be downloaded from Microsoft's web site:
https://www.microsoft.com/en-us/download/details.aspx?id=7887


After downloading and installing the tool on your Windows 7 computer, use the Turn Windows features on or off function from Control Panel, to enable AD management tools.

  • From the Control Panel, click on Programs.
  • Under Programs and Features, select Turn Windows features on or off.
  • Under Remote Server Administration Tools > Role Administration Tools, select AD DS and AD LDS Tools.