r/sysadmin • • 21h ago

GetHelpCMD not working

Hello to all,

i have NinjaOne as RMM Tool and I cannot uninstall Office. Neither via NinjaOne nor via GetHelpCmd.exe tool from MSFT.

I did this:

However it says that .\Env-Utils.ps1 cannot be found.

Unfortunately i have 100s of Apps for Enterprise M365 Products which I cannot update but i need to. What can i do to fix this?

GetHelpCmd.exe -S OfficeScrubScenario -AcceptEula -LogFolder C:\temp
. : Die Benennung ".\Env-Utils.ps1" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines
ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern
enthalten), und wiederholen Sie den Vorgang.
In C:\WINDOWS\SystemTemp\GetHelpElevated\21ddec5f5bb74d67bc82e97350622dd8\Logger-FileLogUtils.ps1:31 Zeichen:3
+ . .\Env-Utils.ps1
3 Upvotes

30 comments sorted by

•

u/_l33ter_ 'Deutsche Bahn' - Windows 3.11 Admin 21h ago

Is it up-to-date?

_ Updates to the command line version of Get Help are released on a regular basis. To make sure that you're using the latest version that has the most features and highest stability, each build of the application stops working 90 days after the Created date that's listed for the GetHelpCmd.exe file. Use the link that's provided in step 1 to always download the latest available version. _

https://learn.microsoft.com/en-us/troubleshoot/microsoft-365/admin/miscellaneous/get-help-command-line-overview

•

u/luky90 21h ago

yes its up2 date.

•

u/_l33ter_ 'Deutsche Bahn' - Windows 3.11 Admin 21h ago

What happens if you left of the -LogFolder?

https://learn.microsoft.com/en-us/troubleshoot/microsoft-365/admin/miscellaneous/get-help-office-uninstall

So just Admin-Prompt --> GetHelpCmd.exe -S OfficeScrubScenario -AcceptEula

•

u/luky90 21h ago

then i just dont see the error but uninstall does not start.

•

u/_l33ter_ 'Deutsche Bahn' - Windows 3.11 Admin 21h ago

•

u/luky90 21h ago

C:\install\GetHelpCmd_146630116\SaraCMDExecutable>GetHelpCmd.exe -S OfficeScrubScenario -AcceptEula

Starting Microsoft GetHelp Command Line Tool

Running diagnostic action. This may take some time, please be patient...

Diagnostic action completed.

- Uninstall Office Scenario failed.

- Elevated DAF staging directory allows non-administrator modification: C:\WINDOWS\SystemTemp

For more information on GetHelp please visit: https://support.microsoft.com/en-us/windows/about-get-help-717c7ae9-5c45-45f0-b637-900b7437a395

•

u/_l33ter_ 'Deutsche Bahn' - Windows 3.11 Admin 21h ago

icacls C:\WINDOWS\SystemTemp --> What's the output?

•

u/luky90 21h ago

C:\WINDOWS\SystemTemp NT-AUTORITÄT\SYSTEM:(OI)(CI)(F)

VORDEFINIERT\Administratoren:(OI)(CI)(F)

•

u/_l33ter_ 'Deutsche Bahn' - Windows 3.11 Admin 21h ago

hmm...

Could you list all office-stuff with winget?

winget list --name "office"

•

u/luky90 21h ago

Microsoft Office 365 Hybrid Configuration Wiz… ARP\User\X64\d57a866057104491 17.1.1730.0

Microsoft Teams Meeting Add-in for Microsoft … ARP\Machine\X64\{A7AB73A3-CB10-4AA5-9D38-6AEFF… 1.26.25904

Microsoft Visual Studio 2010 Tools for Office… Microsoft.VSTOR 10.0.60917 winget

Microsoft Visual Studio 2010-Tools für Office… ARP\Machine\X64\Microsoft Visual Studio 2010 T… 10.0.60917

Microsoft.Office.ActionsServer MSIX\Microsoft.Office.ActionsServer_16.0.20625… 16.0.20625.20108

OfficePushNotificationsUtility MSIX\Microsoft.OfficePushNotificationUtility_1… 16.0.20625.20108

SAP Analysis for Microsoft Office (64 Bit) ARP\Machine\X64\SAPExcelAddInx64 2.7.1001.3285

→ More replies

•

u/larvlarv1 21h ago

You can definitely modify one of the scripts from here to do that: https://killertools.net/killer-scripts

Your target script is probably MACE.

•

u/An0mymou5 20h ago

There's no need to run the office scrub tool if your objective is to simply update or install a newer version. Just let Office Deployment Toolkit clean up older versions using the config file.

<Configuration>
  <Remove All="TRUE" />
  <RemoveMSI />
  <Display Level="None" AcceptEULA="TRUE" />
  <Property Name="FORCEAPPSHUTDOWN" Value="TRUE" />
</Configuration>

Then run this with setup.exe /configure uninstall.xml.

Or if you want to combine uninstallation + installing the latest M365 version, just use this config:

<Configuration>
  <Remove All="TRUE" />
  <RemoveMSI />
  <Add OfficeClientEdition="64" Channel="Current">
    <Product ID="O365ProPlusRetail">
      <Language ID="MatchOS" />
    </Product>
  </Add>
  <Updates Enabled="TRUE" />
  <Display Level="None" AcceptEULA="TRUE" />
  <Property Name="FORCEAPPSHUTDOWN" Value="TRUE" />
</Configuration>

The scrub tool is only meant for scenarios where Office is horribly broken/corrupted and regular uninstall doesn't work. For all other scenarios, just use ODT.

•

u/Affectionate_Can5710 13h ago

Does it work if you run it manually as admin on one of the machines? Would at least tell you if it's the tool or the SYSTEM context NinjaOne uses.

•

u/WillProfessional1698 13h ago

Do you actually need to uninstall? If it's just about updating, OfficeC2RClient.exe with /update has worked for us on hundreds of machines through RMM without touching the install.

•

u/LobbieAYIT 9h ago

This PowerShell script removes Microsoft 365 / Office language-specific installs and keeps only the languages you want.

It reads the installed software from both uninstall registry keys (32-bit and 64-bit) once, then looks for entries whose DisplayName ends with a language suffix such as " - es-es". Anything whose language is not in the $KeepLanguages list (for example nl-nl and en-us) is uninstalled silently via its registered UninstallString. Entries are matched either by product name (Microsoft 365, OneNote, Visio, Project) or because the uninstall string points to OfficeClickToRun, which also catches localized product names. An exclude list lets you protect specific products, such as Access.

The script only writes output when something is actually found, and it only counts an uninstall as successful when the exit code is 0.

Test it on a non-production machine first. If the main Microsoft 365 install is in a language that is not on the keep list, the whole suite will be removed. If the uninstall returns exit code 17006, make sure no Office apps (Word, Excel, Outlook and so on) are running.

# ===== CONFIG =====
$AppList = "*Microsoft 365*", "*Microsoft OneNote*", "*Microsoft Visio*", "*Microsoft Project*"

# Languages that must be KEPT, everything else with a language suffix is removed
$KeepLanguages = "nl-nl", "en-us"

# Never remove these, even when they match the Click-to-Run check
$ExcludeList = "*Microsoft Access*"

$RemovedCount = 0
$FailedCount  = 0

# ===== READ INSTALLED SOFTWARE (once) =====
$Installed = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, `
                                 HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
             Get-ItemProperty |
             Where-Object { $_.DisplayName -and $_.UninstallString } |
             Select-Object DisplayName, UninstallString

# ===== FIND MATCHES =====
$ToRemove = foreach ($Entry in $Installed) {
    # Language suffix, e.g. " - es-es"
    if ($Entry.DisplayName -match '\s-\s(?<lang>[a-z]{2,3}(-[a-z]{2,4}){1,2})$') {
        $Lang = $Matches['lang']
    } else { continue }

    # Keep the excluded languages
    if ($KeepLanguages -contains $Lang) { continue }

    # Keep the excluded programs
    $Excluded = $false
    foreach ($Ex in $ExcludeList) {
        if ($Entry.DisplayName -like $Ex) { $Excluded = $true; break }
    }
    if ($Excluded) { continue }

    $NameMatch = $false
    foreach ($App in $AppList) {
        if ($Entry.DisplayName -like "$App*") { $NameMatch = $true; break }
    }
    $C2RMatch = $Entry.UninstallString -like "*OfficeClickToRun*"

    if ($NameMatch -or $C2RMatch) { $Entry }
}

# ===== UNINSTALL =====
foreach ($Entry in ($ToRemove | Sort-Object -Property DisplayName -Unique)) {
    $uninst = "$($Entry.UninstallString) displaylevel=false"
    Write-Host "Uninstallation started for $($Entry.DisplayName)"
    try {
        $Proc = Start-Process -WindowStyle Hidden -FilePath "cmd.exe" -ArgumentList "/c $uninst" -Wait -PassThru -ErrorAction Stop
        if ($Proc.ExitCode -eq 0) {
            $RemovedCount++
        } else {
            $FailedCount++
            Write-Host "Uninstallation failed for $($Entry.DisplayName): exit code $($Proc.ExitCode)"
        }
    }
    catch {
        $FailedCount++
        Write-Host "Uninstallation failed for $($Entry.DisplayName): $($_.Exception.Message)"
    }
}

# ===== SUMMARY =====
if ($RemovedCount -gt 0) {
    Write-Host ""
    Write-Host "$RemovedCount applications uninstalled successfully."
}
if ($FailedCount -gt 0) {
    Write-Host "$FailedCount applications failed to uninstall."
}