Skip to main content

All Windows 10 Workstations

I tried 1 of the Dell Command Update Worklets and get this error on some workstations:

Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At C:\Program Files (x86)\Automox\execDir2926109883\execcmd3901365964.ps1:59 char:16
+ ...      [void](Start-Process -FilePath $exe -ArgumentList "/s /l='$log'" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
 

COMMAND TIMED OUT.

 

I’m looking to either find out why this error is happening or get a worklet with evaluation and  remediation code that can be used to successfully check which patches are needed and then install them and let me know which ones get installed.

 

thanks.

Hi @jasonehand !

From the error you are receiving, it looks like the worklet is unable to find the $exeused in the Start-Process command.


Given there are a handful of Dell Command Update worklets within the Community here, can you share the one that you are using?


sure: any Help is sure appreciated!

Evaluation Code:

$system = Get-WmiObject win32_computersystem

IF($system.Manufacturer -match "Dell"){ Exit 1 }else { Exit 0 }

 

Remediation Code:

# Dell Command | Update executable uploaded to worklet

$exe = 'Dell-Command-Update-Application-for-Windows10_JDXHH_WIN_4.2.0_A00.EXE'

# Dell Command Version

[version]$version = '4.2.0'

# Log location

$log = 'C:\Windows\Temp\DellCommand_Install.txt'

$system = Get-WmiObject win32_computersystem

IF($system.Manufacturer -match "Dell"){ 

    # Find versions of Dell Command installed

    $scriptblock = {

      Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*' | where DisplayName -match 'Dell Command'

    }

    # Run the scriptblock and store results in the $64bit variable

    $software = & "$env:SystemRoot\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -NonInteractive -Command $scriptblock

    function Install-DellCommand{

        [void](Start-Process -FilePath $exe -ArgumentList "/s /l='$log'" -wait -PassThru)

        IF($? -eq "True"){

            return $true

        }else{

            return $false

        }

 

        Start-Sleep -Seconds 20

        # Configure Dell Command Update

        Write-Host

        $Arguments = 'scheduleAuto',

                        'lockSettings=enable',

                        'userConsent=disable',

                        'scheduleMonthly=28,00:45',

                        'scheduledReboot=0',

                        'autoSuspendBitLocker=enable'

        foreach ($Arg in $Arguments){

            $results = Start-Process -FilePath "C:\Program Files\Dell\CommandUpdate\dcu-cli.exe" -ArgumentList "/configure -$Arg" -Wait | Out-Null

            Start-Sleep -Seconds 5

        }

    }

    # IF Dell Command is not installed or older version exists

    IF(!$software){

        Write-Output "Installing Dell Command. "

        IF(Install-DellCommand){Write-Output "Installed Dell Command. "}else{Write-Output "Failed to install Dell Command. "; exit 1}

    }else{

        # Remove older versions of Dell Command

        foreach ($title in $software){

            IF([version]$title.DisplayVersion -lt $version){

                Write-Output "Uninstall Dell Command $($title.DisplayVersion). "

                $UninstallString = $title.UninstallString | Select-String -Pattern '{[-0-9A-F]+?}' -AllMatches | Select-Object -ExpandProperty Matches | Select-Object -ExpandProperty Value

                Start-Process MsiExec -ArgumentList "/X $UninstallString /qn" -Wait

                Write-Output "Installing Dell Command. "

                IF(Install-DellCommand){Write-Output "Installed Dell Command. "}else{Write-Output "Failed to install Dell Command. "; exit 1}

            }

        }

    }

    # Apply Updates

    Function Start-DellCommandUpdates {

        # 2 minute timeout if dcu-cli is already running

        $dcu = Get-Process dcu-cli -ErrorAction SilentlyContinue

        IF($dcu){

            Write-Output "dcu-cli currently running. Wait for process to complete. "

            $startDate = Get-Date

            do{}while((Get-Process dcu-cli -ea SilentlyContinue) -and $startDate.AddMinutes(2) -gt (Get-Date))

            $dcu = Get-Process dcu-cli -ErrorAction SilentlyContinue

            IF($dcu){Stop-Process dcu-cli -Force}

        }

        # Run dcu-cli

        Write-Output "Starting Dell Command Update Process. "

        Start-Process -FilePath "C:\Program Files\Dell\CommandUpdate\dcu-cli.exe" -ArgumentList "/applyUpdates" -Wait

    }

    Start-DellCommandUpdates

    # Get Activity

    Function Get-DellCommandActivity {

        # Get Activity Log and parse intalled updates in last 24 hours

        [xml]$a = Get-Content "C:\ProgramData\dell\UpdateService\Log\Activity.log"

        $range = (Get-Date).AddHours(-24)

        # Write output on Checking Updates

        $events = $a.LogEntries.LogEntry | Select timestamp,message | where {[datetime]$_.timestamp -gt $range -and ($_.message -match 'found' -or $_.message -match 'Checking for updates' -or $_.message -match 'verified')} | % {

            $timestamp = (Get-Date $_.timestamp -Format 'yyyy-MM-dd hh:mm tt')

            $message = $_.message.replace(' verified.','')

            [pscustomobject] @{

                timestamp = $timestamp

                message = $message

            }

        }

        foreach ($event in $events)

        {

            Write-Output "$($event.timestamp) $($event.message). "

        }

    }

    $activity = Get-DellCommandActivity

    foreach ($event in $activity){

        Write-Output "$event"

    }

    IF($activity.count -eq 0){

        Write-Output "Something went wrong. Trying to run Dell Command Update again. "

        Get-Process dcu-cli -ErrorAction SilentlyContinue | Stop-Process -ErrorAction SilentlyContinue -Force

        Start-DellCommandUpdates

        $activity = Get-DellCommandActivity

        foreach ($event in $activity){

            Write-Output "$event"

        }

        IF($activity.count -eq 0){

            IF(Test-Path 'C:\Program Files\Dell\CommandUpdate\dcu-cli.exe'){

                Write-Output "Something isn't working right. Recommend running this locally and analyzing output: 'C:\Program Files\Dell\CommandUpdate\dcu-cli.exe' /applyUpdates "

                Write-Output $activity

            }else{Write-Output "Dell Command failed to install. "}

        }

    }

}else{Write-Host "Not recognized as Dell Manufacturer. Not running." }

 


@jasonehand 

I’ve got two worklets going. One that ensures Dell Command is installed and one that runs Dell Command. 

This recent thread has the code, a bit all over the place, but all the parts are there. 

 

 


@jack.smith 

 

thanks, no errors, but what does this mean under reports, did it just not find anything to install? How can i see what it found to install and when it’s installed? If it does find something to install, will it show it installed?

 

Currently Dell Command | Update version 5.4.0 Installed. 
Starting Dell Command Update Process. 
Dell Command Reported Command execution was successful.
2024-10-07 11:00 PM Checking for updates. 
2024-10-07 11:00 PM Checking for updates


@jasonehand ,

That’s only scrubbing a part of the activity due to this snippet of the code in the Get-DellCommandActivity function:

-and ($_.message -match 'found' -or $_.message -match 'Checking for updates' -or $_.message -match 'verified')

 

This updated Get-DellCommandActivity function will output the last 24 hours of the log. A lot easier to just get all of it and see exactly what’s going on. 

Function Get-DellCommandActivity {
# Get Activity Log and parse intalled updates in last 24 hours
[xml]$a = Get-Content "C:\ProgramData\dell\UpdateService\Log\Activity.log"
$range = (Get-Date).AddHours(-24)
# Write output on Checking Updates
$events = $a.LogEntries.LogEntry | Select timestamp,message | where {[datetime]$_.timestamp -gt $range } | % {
$timestamp = (Get-Date $_.timestamp -Format 'yyyy-MM-dd hh:mm tt')
$message = $_.message.replace(' verified.','')
[pscustomobject] @{
timestamp = $timestamp
message = $message
}
}
foreach ($event in $events)
{
Write-Output "$($event.timestamp) $($event.message). "
}
}

 


running now and i get the following, still looking to see a confirmation on which updates are installed if possible.

 

Currently Dell Command | Update version 5.4.0 Installed. 
Starting Dell Command Update Process. 
Dell Command Reported Command execution was successful.
2024-10-17 07:42 AM Checking for updates. 
2024-10-17 09:52 AM Checking for updates. 
2024-10-17 09:52 AM Checking for updates. 
2024-10-17 09:52 AM Applicable updates were retrieved from the cache.. 
2024-10-17 09:54 AM Checking for updates. 
2024-10-17 09:54 AM Applicable updates were retrieved from the cache.. 
2024-10-17 09:54 AM Checking for updates. 


@jasonehand did you update the function to stop parsing the log and just give you all output? Right now its incorrectly parsing the log, and due to changes over time, the output is not great anymore. In hindsight I should have just dumped the entire log for X hours which is what that function should be doing. 


i updated the remediation script with the change you mentioned, but what I just entered is what I see in Automox, it never confirms if installs were made and what they were.


@jasonehand the function then should pull the entire log. if that’s what it shows in activity with that specific function, then it did nothing but check for updates.