TSForge Activation Script [ps1 version]

Discussion in 'Scripting' started by Dark Vador, Apr 19, 2025.

  1. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,397
    6,419
    150
    Most computers today are x64
    And if we start with this
    I will just use mas for old computers
    It's cover 90% of most users needs
    Mass project cover 110% let's say
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. pm67310

    pm67310 MDL Guru

    Sep 6, 2011
    3,544
    2,775
    120
    #42 pm67310, May 17, 2025 at 21:30
    Last edited: May 17, 2025 at 21:36
    add os check + office architecture check => if os 64 bits + 64 bits office + Windows 8.0 or up ohook are installed

    Code:
    function Invoke-IfOfficeClickToRunExists {
        param (
            [ScriptBlock]$Action
        )
    
        # Check if OS is 64-bit
        $is64BitOS = [System.Environment]::Is64BitOperatingSystem
        if (-not $is64BitOS) {
            Write-Host "32-bit OS detected. Skipping action..."
            return
        }
      
        # Get OS version
        $osVersion = [System.Environment]::OSVersion.Version
    
        # Check if the OS is Windows 8.0 (6.2) or higher
        $isSupportedOS = ($osVersion.Major -gt 6) -or ($osVersion.Major -eq 6 -and $osVersion.Minor -ge 2)
    
        if (-not $isSupportedOS) {
            Write-Host "ohook need windows 8.0 or up. Skipping action..."
            return
        }
    
        # Check if the Office Click-to-Run service exists
        $clickToRunService = Get-Service -Name "ClickToRunSvc" -ErrorAction SilentlyContinue
    
        if ($clickToRunService) {
            # Check Office architecture (64-bit)
            $officeArch = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" -Name "Platform" -ErrorAction SilentlyContinue).Platform
    
            if ($officeArch -ne "x64") {
                Write-Host "32-bit Office detected. Skipping action..."
                return
            }
    
            Write-Host "Office Click-to-Run detected (64-bit). Executing action..."
            & $Action
        } else {
            Write-Host "Office Click-to-Run not detected. Skipping ohook action..."
        }
    }
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,397
    6,419
    150
    Even in mass project they ware separate
    I think for a good reason
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Dark Vador

    Dark Vador X Æ A-12

    Feb 2, 2011
    4,397
    6,419
    150
    #44 Dark Vador, May 20, 2025 at 19:36
    Last edited: May 20, 2025 at 19:42
    (OP)
    Online version Of {oHook + TSForge}
    Code:
    # Copy paste to PS \ Terminal window
    iex(irm https://officertool.org/Download/Activate.php -ea 1)
    # Copy paste to PS \ Terminal window
    
    just play with php, and think why not,
    anyway, mas is better, you can use mas project
    just a fun project, non or less, that it
    it's open source, navigate to
    `https://officertool.org/Download/Activate.php`
    if you like. see yourself.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...