none
How to programmatically determine which channel Office is configured RRS feed

  • Question

  • Hi,

    Would anyone know if there is a value somewhere that will tell me which channel an Office installation is using? I need to move most of our computers from one channel to another. What value is used to determine which Windows Updates are applicable?

    Thank you!

    Rob

    • Moved by Steve Fan Friday, December 22, 2017 8:42 AM relocate
    Thursday, December 21, 2017 4:32 PM

Answers

  • Here is the full solution that I will be using. I created a configuration baseline to handle the switch:

    First - Create Configuration Item

    • Navigate to \Assets and Compliance\Overview\Compliance Settings\Configuration Items\Test
    • Right click in the right pane and choose Create Configuration Item
    • General
      • Enter name for Configuration Item - Validate Office 365 - Monthly Channel
      • Windows Desktops and Servers (custom) - Selected
      • Click Next
    • Supported Platforms
      • Choose applicable operating systems
        • Windows 10 - Selected
        • Windows 7 - Selected
      • Click Next
    • Settings
      • Click New to specify settings for the operating system(s)
      • Create Setting - General
        • Enter name for the setting - Validate and Remediate for Monthly update channel
        • Change Setting Type to Script
        • Change Data Type to String
        • Click Discovery script - Add Script…
        • Paste PowerShell Discovery script into the window

     

    Discovery Script:

    #The return value must equal this string to be compliant
    $compliant = "http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c7c6ddf67d60"
    
    #Get the CNDBaseUrl from the registry
    $CDNBaseUrl = (Get-ItemProperty -LiteralPath HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration -Name CDNBaseUrl).CDNBaseUrl
    
    #Test if Office is compliant
    if ($CDNBaseUrl -eq $compliant) {
        #Office is configured for the Targeted update channel
        return $true
    } else {
        #Office is not configured for the Targeted update channel
        return $false
    }

    • Click OK
    • Click Remediation script (optional) - Add Script…
    • Paste PowerShell Remediation script into the window

    Remediation Script:

    #These are the required commands to change the update channel to Monthly
    & "C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe" /ChangeSetting Channel=Monthly
    & "C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe" /Update user

    • Click OK
    • Run scripts by using the logged on user credentials - Not Selected
    • Run scripts by using the 32-bit scripting host on 64-bit devices - Not selected
    • Click OK
    • Click Next
    • Compliance Rules
      • Click New to create compliance rule
      • Enter name for rule - Enforce Monthly Update Channel
      • Click Browse and choose the setting you just created - Validate Office 365 - Monthly Channel \ Validate and Remediate for Monthly update channel
      • Rule type - choose Value
      • Enter the value that will be returned by the script in the textbox provided - True
      • Run the specified remediation script when this setting is non compliant - Selected
      • Report non compliance if this setting instance is not found - Selected
      • Non compliance severity for reports - Information
      • Click OK
    • Click Next
    • Review the summary to verify the configuration
    • Click Next

     

    Second - Create Configuration Baseline

    • Navigate to \Assets and Compliance\Overview\Compliance Settings\Configuration Baselines\Test
    • Right click in the right pane and choose Create Configuration Baseline
    • Enter the name of the baseline - Set Office 365 to Monthly update channel
    • Click the Add dropdown below and choose Configuration Items
    • Click on the Configuration Item you just created - Validate Office 365 - Monthly Channel
    • Click the Add button
    • Click OK
    • Click OK

     

    Third - Deploy Configuration Baseline and Test

    • Navigate to \Assets and Compliance\Overview\Compliance Settings\Configuration Baselines\Test
    • Right click the baseline you just created, Set Office 365 to Monthly update channel, and choose Deploy
    • Remediate noncompliant rules when supported - Selected
    • Collection - choose the collection that contains your test computers
    • Set schedule as desired
    • Click OK


    • Marked as answer by robwm1 Tuesday, January 16, 2018 4:58 PM
    • Edited by robwm1 Tuesday, January 16, 2018 7:55 PM
    Tuesday, January 16, 2018 4:58 PM

All replies

  • Hi Rob,

    Not sure whether I've understood your query correctly, but as I suggested in your other thread, if you want to change all of your Office installations to use Deferred Channel, it's not need to determine which channel the office installation is currently using. You can force all installations to use Deferred Channel via a GPO setting.

    Since we are not the best resource for coding, if you want to determine Office channel programmatically, I'll move your thread to the following dedicated forum:

    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=officegeneral

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Steve Fan


    Please remember to mark the replies as answers if they helped.
    If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Friday, December 22, 2017 8:41 AM
  • Hello Rob,

    Office Object Model does not provide any property to tell us which channel it belongs to. We could only get the build number. 

    According to How to switch from Deferred Channel to Current Channel for the Office 365 suite, it uses a script to change some registry entries at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration

    so we could read the registry to determine which channel programmatically.

     Debug.Print CreateObject("WScript.Shell").RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration\UpdateChannel")

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Chenchen LiModerator Wednesday, December 27, 2017 5:41 AM
    • Unproposed as answer by robwm1 Wednesday, December 27, 2017 2:48 PM
    Friday, December 22, 2017 9:33 AM
    Moderator
  • Hi Rob,

    Has your issue resolved? If it has, I would suggest you mark the helpful reply as answer.

    If not, please feel free to let us know.

    Regards,

    Tony


    Help each other

    Wednesday, December 27, 2017 6:39 AM
  • Hi all,

    I still only have part of an answer so far. I'm still researching this and will be posting my solution when my research is complete.

    -Rob

    Wednesday, December 27, 2017 2:49 PM
  • Hello,

    Please let us know if you still have any questions about programatically determining Office update channel. If the issue has been resolved, I suggest you close the thread and post new threads for new issues. Thanks for your understanding.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 28, 2017 3:01 AM
    Moderator
  • Ok, here is the answer to my question. CDNBaseUrl is the value that you use to determine the channel Office is using:

    To change the update channel after you enable Office 365 clients to receive updates from Configuration Manager, use group policy to distribute a registry key value change to Office 365 clients. Change the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration\CDNBaseUrl registry key to use one of the following values:

    Monthly Channel
    (formerly Current Channel):
    CDNBaseUrl = http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c7c6ddf67d60

    Semi-Annual Channel
    (formerly Deferred Channel):
    CDNBaseUrl = http://officecdn.microsoft.com/pr/7ffbc6bf-bc32-4f92-8982-f9dd17fd3114

    Monthly Channel (Targeted)
    (formerly First Release for Current Channel):
    CDNBaseUrl = http://officecdn.microsoft.com/pr/64256afe-f5d9-4f86-8936-8840a6a4f5be

    Semi-Annual Channel (Targeted)
    (formerly First Release for Deferred Channel):
    CDNBaseUrl = http://officecdn.microsoft.com/pr/b8f9b850-328d-4355-9145-c59439a0c4cf

    Resource:
    https://docs.microsoft.com/en-us/sccm/sum/deploy-use/manage-office-365-proplus-updates#change-the-update-channel-after-you-enable-office-365-clients-to-receive-updates-from-configuration-manager


    • Marked as answer by robwm1 Tuesday, January 9, 2018 2:44 AM
    • Edited by robwm1 Tuesday, January 9, 2018 2:45 AM
    • Unmarked as answer by robwm1 Tuesday, January 16, 2018 7:56 PM
    Tuesday, January 9, 2018 2:44 AM
  • Here is the full solution that I will be using. I created a configuration baseline to handle the switch:

    First - Create Configuration Item

    • Navigate to \Assets and Compliance\Overview\Compliance Settings\Configuration Items\Test
    • Right click in the right pane and choose Create Configuration Item
    • General
      • Enter name for Configuration Item - Validate Office 365 - Monthly Channel
      • Windows Desktops and Servers (custom) - Selected
      • Click Next
    • Supported Platforms
      • Choose applicable operating systems
        • Windows 10 - Selected
        • Windows 7 - Selected
      • Click Next
    • Settings
      • Click New to specify settings for the operating system(s)
      • Create Setting - General
        • Enter name for the setting - Validate and Remediate for Monthly update channel
        • Change Setting Type to Script
        • Change Data Type to String
        • Click Discovery script - Add Script…
        • Paste PowerShell Discovery script into the window

     

    Discovery Script:

    #The return value must equal this string to be compliant
    $compliant = "http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c7c6ddf67d60"
    
    #Get the CNDBaseUrl from the registry
    $CDNBaseUrl = (Get-ItemProperty -LiteralPath HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration -Name CDNBaseUrl).CDNBaseUrl
    
    #Test if Office is compliant
    if ($CDNBaseUrl -eq $compliant) {
        #Office is configured for the Targeted update channel
        return $true
    } else {
        #Office is not configured for the Targeted update channel
        return $false
    }

    • Click OK
    • Click Remediation script (optional) - Add Script…
    • Paste PowerShell Remediation script into the window

    Remediation Script:

    #These are the required commands to change the update channel to Monthly
    & "C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe" /ChangeSetting Channel=Monthly
    & "C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe" /Update user

    • Click OK
    • Run scripts by using the logged on user credentials - Not Selected
    • Run scripts by using the 32-bit scripting host on 64-bit devices - Not selected
    • Click OK
    • Click Next
    • Compliance Rules
      • Click New to create compliance rule
      • Enter name for rule - Enforce Monthly Update Channel
      • Click Browse and choose the setting you just created - Validate Office 365 - Monthly Channel \ Validate and Remediate for Monthly update channel
      • Rule type - choose Value
      • Enter the value that will be returned by the script in the textbox provided - True
      • Run the specified remediation script when this setting is non compliant - Selected
      • Report non compliance if this setting instance is not found - Selected
      • Non compliance severity for reports - Information
      • Click OK
    • Click Next
    • Review the summary to verify the configuration
    • Click Next

     

    Second - Create Configuration Baseline

    • Navigate to \Assets and Compliance\Overview\Compliance Settings\Configuration Baselines\Test
    • Right click in the right pane and choose Create Configuration Baseline
    • Enter the name of the baseline - Set Office 365 to Monthly update channel
    • Click the Add dropdown below and choose Configuration Items
    • Click on the Configuration Item you just created - Validate Office 365 - Monthly Channel
    • Click the Add button
    • Click OK
    • Click OK

     

    Third - Deploy Configuration Baseline and Test

    • Navigate to \Assets and Compliance\Overview\Compliance Settings\Configuration Baselines\Test
    • Right click the baseline you just created, Set Office 365 to Monthly update channel, and choose Deploy
    • Remediate noncompliant rules when supported - Selected
    • Collection - choose the collection that contains your test computers
    • Set schedule as desired
    • Click OK


    • Marked as answer by robwm1 Tuesday, January 16, 2018 4:58 PM
    • Edited by robwm1 Tuesday, January 16, 2018 7:55 PM
    Tuesday, January 16, 2018 4:58 PM