0

First, this is not the same question as this question.

I am trying to use PSRemoting to run dcu-cli.exe on a remote system first to gather the version number and later to actually install the updates. PSEXEC is not an option for me. The version of dcu-cli.exe I am using is 3.1. For right now I just want to capture the output of the /version parameter.

Running the following command from PowerShell on my local machine produces the following output:

& "C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" /version

Output:

Version information displayed: Dell Command | Update v3.1
Program exited with return code: 0

Here is what I've tried so far. Unless otherwise specified, the output is as follows. Sometimes the output is in a log file (depending on the command line):

An unexpected fatal error occurred
Program exited with return code: 2

From watching Process Explorer, it is actually running, but something somewhere is going wrong and I'm baffled as to what. Explicit credentials are not supplied as I am running the script as an administrator account and that account exists and is an administrator on the remote machine.

Any help would be appreciated.

Attempts:

Invoke-Command -ComputerName $Destinations[0] -EnableNetworkAccess -ScriptBlock {& "C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" /version}

Invoke-Command -ComputerName $Destinations[0] -EnableNetworkAccess -ScriptBlock {& cmd.exe /c '"C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" /version'}

Invoke-Command -ComputerName $Destinations[0] -EnableNetworkAccess -ScriptBlock {& cmd.exe /c 'start "" /Wait "C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" /version'}

No output


Invoke-Command -ComputerName $Destinations[0] -EnableNetworkAccess -ScriptBlock {& cmd.exe /c 'start "" /B /Wait "C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" /version'}

$ScriptBlock={Start-Process -FilePath "C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" -ArgumentList "/version" -Wait -Verb "RunAs"}
Invoke-Command -ComputerName $Destinations[0] -EnableNetworkAccess -ScriptBlock $ScriptBlock

No output


$ScriptBlock={Start-Process -FilePath "C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" -ArgumentList "/version" -Wait -RedirectStandardOutput C:\temp\version.log}
Invoke-Command -ComputerName $Destinations[0] -EnableNetworkAccess -ScriptBlock $ScriptBlock

$ScriptBlock={Start-Process -FilePath "C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" -ArgumentList "/version" -Wait -PassThru -RedirectStandardOutput C:\temp\version.log}
Invoke-Command -ComputerName $Destinations[0] -EnableNetworkAccess -ScriptBlock $ScriptBlock

Process information is returned in addition to the normal erroneous output.


$ScriptText=@'
$ProcessInfo=[System.Diagnostics.ProcessStartInfo]::new("C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe")
$ProcessInfo.RedirectStandardError=$true
$ProcessInfo.RedirectStandardOutput=$true
$ProcessInfo.UseShellExecute=$false
$ProcessInfo.Arguments="/version"
$Process=[System.Diagnostics.Process]::new()
$Process.StartInfo=$ProcessInfo
$Process.Start() > $null
$Version=$Process.StandardOutput.ReadToEnd()
$Process.WaitForExit()
$Version
'@
$ScriptBlock=[System.Management.Automation.ScriptBlock]::Create($ScriptText)
Invoke-Command -ComputerName $Destinations[0] -EnableNetworkAccess -ScriptBlock $ScriptBlock

$ScriptText=@'
$ProcessInfo=[System.Diagnostics.ProcessStartInfo]::new("C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe")
$ProcessInfo.RedirectStandardError=$true
$ProcessInfo.RedirectStandardOutput=$true
$ProcessInfo.UseShellExecute=$false
$ProcessInfo.Arguments="/version"
$ProcessInfo.Verb="RunAs"
$Process=[System.Diagnostics.Process]::new()
$Process.StartInfo=$ProcessInfo
$Process.Start() > $null
$Version=$Process.StandardOutput.ReadToEnd()
$Process.WaitForExit()
$Version
'@
$ScriptBlock=[System.Management.Automation.ScriptBlock]::Create($ScriptText)
Invoke-Command -ComputerName $Destinations[0] -EnableNetworkAccess -ScriptBlock $ScriptBlock
  • You cannot natively use PowerShell to run a user-based gui based application on a remote host. Someone needs to be logged on to the machine. So, either deploy via GPO, SCCM, 3rdP software distribution tool or deploy your script to the targets or to a share that a user can reach, and set a scheduled task to run this at user logon, or use PSExec (which you say you cannot use) or other 3rdP tools. – postanote Feb 20 '20 at 06:56
  • 1
    @postanote It's not a GUI application. [Dell Command | Update Version 3.1 User's Guide](https://www.dell.com/support/manuals/us/en/04/command-update-v3.1/dellcommandupdate_3.1_ug/command-line-interface-reference?guid=guid-92619086-5f7c-4a05-bce2-0d560c15e8ed&lang=en-us) – Slogmeister Extraordinaire Feb 20 '20 at 13:37
  • OK, I don't have a need for this tool, but what appears to be happening is the same thing. It's taking your Windows logon session, as you see when you do it locally, but that is not what is happening on the remote system, and that exe is confused. I still suggest setting up a scheduled task and running this use case to determine root cause. If it runs as a task successfully, then one would assume it means that exe expects to run from a Windows profile that is local and logged on. Your other test option is to not use Invoke, but Enter-PSSession and try interactively. – postanote Feb 20 '20 at 19:18

1 Answers1

0

(late answer... I know...)

You can run dcu-cli.exe remotely using either powershell or psexec

Powershell

  • the problem I had was figuring out how to pass "/applyUpdates" to dcu-cli instead of having it interpreted by powershell

  • Breaking the dcu-cli invocation into two separate steps works (cd ..., then .\dcu-cli)

  • I am logged in to my workstation as a user with local admin rights on the remote computer.

    $pcname="ss-frontdesk"
    $exePath="\program files\dell\commandupdate"
    invoke-command -computername $pcname {cd "$using:exePath"; .\dcu-cli /applyUpdates -reboot=enable}
    

 

PSEXEC

  • now being blocked by sophos endpoint -- hence my research into powershell...

  • again, my local windows user is an admin on the remote workstation

    set pcname=ss-frontdesk
    set EXE=dcu-cli.exe 
    set DIR=C:\Program Files\Dell\CommandUpdate 
    set ARGS=/applyUpdates -reboot=enable 
    psexec \\%pcname% -s "%DIR%\%EXE%" %ARGS%
    

 

Notes

  • I've been using a batch file w/ psexec to update the bios on my dell workstations for 2 - 3 years

    • about 15% of the time, the bios will not update using dcu-cli. Sometimes it can then be updated by running Dell Command|Update manually over RDP, sometimes that doesn't work but running Dell Command|Update directly on the system works, and sometimes that doesn't work and I have to update the bios from a USB drive
  • You can get the bios version (if that's all you're looking for) using:

    set pcname=ss-frontdesk
    wmic  /node:"%pcname%" bios get smbiosbiosversion |findstr /v "SMBIOSBIOSVersion" |findstr /r /v "^$"
    
    • wmic needs quotes around %pcname% if the name contains a dash as in the example
    • The "findstr" commands eliminate everything from the output except the bios version
  • Some of my systems have dcu-cli in "\Program Files (x86)" instead of in "\Program Files"...

[edit]

You can also use "sigcheck" from sysinternals to check the version of Dell Command|Update on remote systems if you have SMB access to C:\

@echo off
: F:\software\sysinternals contains sigcheck.exe...
set PATH=F:\software\sysinternals;%PATH%
setlocal enabledelayedexpansion
set PATHTOCHECK32=Program Files (x86)\Dell\CommandUpdate
set PATHTOCHECK64=Program Files\Dell\CommandUpdate
set FILETOCHECK=dcu-cli.exe

: Loop through all pc names included on the command line...

:start
if "%1"=="" goto :eof
call :checkit %1
shift
goto :start


:checkit
: note: PCNAME ends in 20 spaces (plus "x") for output formatting

ping -n 1 -w 1 %1 >nul 2>&1
if ERRORLEVEL 1 goto :noping

if exist "\\%1\c$\!PATHTOCHECK64!\!FILETOCHECK!" (
        set PCNAME=%1                    x
        echo |set /p=!PCNAME:~0,20!
        sigcheck -nobanner -n "\\%1\c$\!PATHTOCHECK64!\!FILETOCHECK!"
        goto :eof
)
if exist "\\%1\c$\!PATHTOCHECK32!\!FILETOCHECK!" (
        set PCNAME=%1 ^(x86^)                    x
        echo |set /p=!PCNAME:~0,20!
        sigcheck -nobanner -n "\\%1\c$\!PATHTOCHECK32!\!FILETOCHECK!"
        goto :eof
)

set PCNAME=%1                    x
echo |set /p=!PCNAME:~0,20!
echo dcu-cli.exe not found
goto :eof

:noping
        set PCNAME=%1                    x
        echo |set /p=!PCNAME:~0,20!
        echo not responding to PING
        goto :eof

:eof
mmccarn
  • 479
  • 1
  • 5
  • 7