Office(R)Tool Project

Discussion in 'Microsoft Office' started by Dark Dinosaur, Nov 6, 2021.

?

Change brand name or not ?

Poll closed Dec 26, 2021.
  1. No, keep it like that

    148 vote(s)
    75.1%
  2. Yes, officeRTool need fresh name

    49 vote(s)
    24.9%
  1. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    4,171
    5,978
    150
    update the code, and the output of my new s**ti `rebuild office license` tool
    I don't know if it is useful for anyone, but it could be a resource for something useful in the future
    from every stupid idiotic idea, you can take some knowledge for future projects

    upload_2024-1-20_17-36-46.png

    Code:
    cls
    Write-Host
    
    $LicenseWMI   = $null
    $InstallPath  = $null
    $LicenseList  = $null
    $ServiceClass = $null
    
    $ServiceClass =  gwmi SoftwareLicensingService
    $InstallPath_X64 = Get-ItemProperty -path "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun" -Name "InstallPath" -ea 0
    $InstallPath_X86 = Get-ItemProperty -path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Office\ClickToRun" -Name "InstallPath" -ea 0
    
    if ($InstallPath_X86 -and (Test-path $InstallPath_X86.InstallPath)) {
      $InstallPath = $InstallPath_X86.InstallPath }
    if ($InstallPath_X64 -and (Test-path $InstallPath_X64.InstallPath)) {
      $InstallPath = $InstallPath_X64.InstallPath }
    if (-not $InstallPath) {
      return }
    
    # Get licenses
    $LicenseWMI = GWMI SoftwareLicensingProduct -ErrorAction SilentlyContinue | ? ApplicationId -EQ '0ff1ce15-a989-479d-af46-f275c6370663' | ? LicenseIsAddon -EQ $false
    if (-not $LicenseWMI) {
      return }
    $LicenseList = $LicenseWMI.LicenseFamily.Substring(8)
    $Client_List  = "pkeyconfig-office.xrm-ms,pkeyconfig-office-client15.xrm-ms,client-issuance-root.xrm-ms,client-issuance-stil.xrm-ms,client-issuance-ul.xrm-ms,client-issuance-ul-oob.xrm-ms,client-issuance-root-bridge-test.xrm-ms,client-issuance-bridge-office.xrm-ms"
    
    Write-Host "*** licenses Found:" -BackgroundColor DarkRed
    Write-Host
    
    $LicenseList | % {"- $($_)" }
    Write-Host
    
    # Clean licenses
    try {
    $compilerParameters = New-Object -TypeName CodeDom.Compiler.CompilerParameters
    $compilerParameters.CompilerOptions = '/unsafe'
    
    Add-Type -CompilerParameters $compilerParameters @"
    using System;
    using System.Runtime.InteropServices;
    
    public class API
    { 
        unsafe delegate uint SLOpenDelegate(void** phSLC);
        unsafe delegate uint SLGetSLIDListDelegate(void* hSLC, int eQueryIdType, Guid* pQueryId, int eReturnIdType, uint* pnReturnIds, Guid** ppReturnIds);
        unsafe delegate uint SLUninstallLicenseDelegate(void* hSLC, Guid* pLicenseFileId);
      
        [DllImport("kernel32.dll")]
        static extern IntPtr LoadLibrary(string path);
    
        [DllImport("kernel32.dll")]
        static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
    
        public static void CleanLicenses()
        {
            UninstallLicenses("sppc");
            string ospp = (string)Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\OfficeSoftwareProtectionPlatform", "Path", null);
            if (ospp != null)
            {
                Console.WriteLine("Found Office Software Protection installed, cleaning");
                UninstallLicenses(ospp + "osppc.dll");
            }
        }
    
        public static void UninstallLicenses(string dllPath)
        {
            IntPtr sppc = LoadLibrary(dllPath);
            SLOpenDelegate open = (SLOpenDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(sppc, "SLOpen"), typeof(SLOpenDelegate));
            SLGetSLIDListDelegate getSLIDList = (SLGetSLIDListDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(sppc, "SLGetSLIDList"), typeof(SLGetSLIDListDelegate));
            SLUninstallLicenseDelegate uninstallLicense = (SLUninstallLicenseDelegate)Marshal.GetDelegateForFunctionPointer(GetProcAddress(sppc, "SLUninstallLicense"), typeof(SLUninstallLicenseDelegate));
    
            unsafe
            {
                void* phSLC;
                open(&phSLC);
                uint pnReturnIds;
                Guid* ppReturnIds;
                Guid officeGuid = new Guid("0ff1ce15-a989-479d-af46-f275c6370663");
                if (getSLIDList(phSLC, 0, &officeGuid, 6, &pnReturnIds, &ppReturnIds) != 0)
                {
                    return;
                }
    
                for (int i = 0; i < pnReturnIds; i++)
                {
                    Console.WriteLine(ppReturnIds[i]);
                    uninstallLicense(phSLC, &ppReturnIds[i]);
                }
            }
        }
    }
    "@
    }
    catch {
      return }
    
    Write-Host "*** Un-install GUID:" -BackgroundColor DarkRed
    Write-Host
    [API]::CleanLicenses()
    
    Write-Host
    Write-Host "Re-Install Licenses:" -BackgroundColor DarkRed
    Write-Host
    
    # Restore licenses
    $Client_List.Split(",") | % {
      $LicenseFile = Join-Path $InstallPath "root\Licenses16\$($_)"
      if (Test-Path $LicenseFile) {
          "- $($_)"
          $ServiceClass.InstallLicense(
            @([IO.File]::ReadAllText($LicenseFile))) | Out-Null
    }}
    
    Write-Host
    $LicenseList | % {
      $LicenseName = "$($_)".Replace(" ","")
      $LicenseFile = Join-Path $InstallPath "root\Licenses16\$($LicenseName)"
      "- $($LicenseName)$($pat).xrm-ms"
      foreach ($pat in "-ppd,-ul,-ul-oob".Split(',')) {
        if (Test-Path "$($LicenseFile)$($pat).xrm-ms") {
          $ServiceClass.InstallLicense(
            @([IO.File]::ReadAllText("$($LicenseFile)$($pat).xrm-ms"))) | Out-Null
      }}
    }
    return
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    4,171
    5,978
    150
    Or buy a 365 sub-description ..

    .... .. ...

    I working on replace clean c2r vbs file from Ms
    To PowerShell code. An vbs alternative
    (poor one, but will work)

    I do wonder if Ms push people to use PS
    Provide an alternative!? Nope.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Windows 10 User

    Windows 10 User MDL Guru

    Feb 2, 2017
    2,005
    122
    90
    What does that have to do with Mondo 2016 not being mentioned in "Plan"?
     
  4. oliverjia

    oliverjia MDL Addicted

    Mar 1, 2008
    844
    434
    30
    He's simply providing us with a useful tool. Be grateful when you try to request some feature or ask a question.
    In the end, you didn't pay anything here so he can decide to just ignore your question.
     
  5. Jingzin

    Jingzin MDL Addicted

    Nov 10, 2021
    666
    532
    30
    #1987 Jingzin, Jan 22, 2024
    Last edited: Jan 22, 2024
    very well said @oliverjia

    myself would be more than happy to pay some money esp to developers like msmg, abbodi and to whoever developed OfficeRTool
    if they could have some bank account people like myself could send some money i would most definitely do.
    or some of the tools could simply become something like ntlite, $10 for msmg toolkit would be nothing for me and a lot to developer if many contributed.

    or whoever owns mdl could think of it. Set some bank account people like myself can send some money to and then mdl gives it to developer.
     
  6. Windows 10 User

    Windows 10 User MDL Guru

    Feb 2, 2017
    2,005
    122
    90
    #1988 Windows 10 User, Jan 23, 2024
    Last edited: Jan 24, 2024
    I wasn't ungrateful, just curious. He can ignore me if he wants and he apparently did it.
     
  7. TheSkaffer

    TheSkaffer MDL Senior Member

    May 16, 2010
    289
    56
    10
    #1989 TheSkaffer, Jan 23, 2024
    Last edited: Jan 23, 2024
    Trying this

    thanks for your effort @Dark Dinosaur

    Doing the scrubber first, since there are so many default uninstall options in settings one just miss something , and my bitdefender had to be deactivated... plz dont hack me... :p

    BTW office 365 for Familiy with 5 licenses it indeed called that. Office 365 Home Premium, might be similar, but not in the sub plan I had. Maybe it is different for EMEA/US/ROW/ASEAN etc... Markets
     
  8. TheSkaffer

    TheSkaffer MDL Senior Member

    May 16, 2010
    289
    56
    10
    ok, everything seems to work, it would be helpful if a screenshot of the script running, like this, would be posted in the initial intro...

    upload_2024-1-23_11-53-32.png
     
  9. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    4,171
    5,978
    150
    for the next version.
    if `VBS` engine is not found, or `PS` engine is selected
    if you choose scrub, will use my new PS1 scrub file
    Clean Components in CLSID, will be disabled -
    takes too much time, about 20 minutes :confused:

    upload_2024-1-23_22-54-27.png
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. TheSkaffer

    TheSkaffer MDL Senior Member

    May 16, 2010
    289
    56
    10
    #1992 TheSkaffer, Jan 24, 2024
    Last edited: Jan 24, 2024
    I keep getting errors about integrator missing when trying the V option, not that I need it, but still.

    Testing a bit more on a VM I have...

    Language selection for Office professional Plus 2024 has issues... tried 4 times could not get the combo right,
    default en GB > English > English did not work
    English > English > English did not work

    to be honest I don't know what to expect here

    Maybe I am picking the wrong distro channel, it is not very clear in the pdf how to pair these things...
     
  11. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    4,171
    5,978
    150
    2024 is not supported, it was a test.
    such a product does not exist.
    It does support converting & activate

    Look here.
    https://forums.mydigitallife.net/threads/87850/
    https://forums.mydigitallife.net/threads/87688/
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. TheSkaffer

    TheSkaffer MDL Senior Member

    May 16, 2010
    289
    56
    10
    ok, thanks. I suspected as much, but who knows with MS... is that the same for 365 Pro?
     
  13. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    4,171
    5,978
    150
    365 have their own products id
    you can select 365 products to install,
    select option 2 & 3, option 1 can\can't be consider 365 anymore
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    4,171
    5,978
    150
    365 Supported ID's
    upload_2024-1-24_12-26-0.png
    Non 365 Products
    find in the list, 'O365HomePremRetail'
    upload_2024-1-24_12-26-37.png
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. TheSkaffer

    TheSkaffer MDL Senior Member

    May 16, 2010
    289
    56
    10
    All good, went for 2021 for desktops and still trying things on the VM
     
  16. TheSkaffer

    TheSkaffer MDL Senior Member

    May 16, 2010
    289
    56
    10
    Hum... do I want this running?

    upload_2024-1-26_8-27-19.png

    So many versions...
     
  17. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    4,171
    5,978
    150
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    4,171
    5,978
    150
    #2000 Dark Dinosaur, Jan 28, 2024
    Last edited: Jan 29, 2024
    (OP)
    Update v10 rev 6
    was planned to be released on 1 Jan,
    but I think it's ready. ..

    this release is special !!
    finish all the PS conversations
    Include /rilc /ato replacement (ps version)
    including a custom-made office uninstall `PS1` file,
    based on the original VBS file.
    (this took me only 3-4 days)

    In this version ... if `PS` engine is selected ...
    when press `H` ... will show this instead

    upload_2024-1-28_20-51-30.png
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...