PowerShell & Command Line Based EXE Results Not Displaying


so, work university , use faronics deepfreeze maintain state of our computers.

i upgrading our management process leverage remote capabilities of powershell.  problem is, trying use command line utility deepfreeze, dfc.exe, remotely, via script, check whether computers frozen or thawed

most of dfc command line switches work fine through powershell, such "dfc /version".  correctly display version of deepfreeze installed.  however, command "dfc /isfrozen" not work in powershell.  doesn't display error, or anything, returns me powershell prompt.

here kicker though.  dfc switches work old cmd.exe application.  have tried many variations of invoke-command, start-process, cmd /c, etc.  try , /isfrozen switch work powershell, far have not had success.

one thing did notice though, according documentation /isfrozen returns boolean value.  question is, there reason why returned boolean value cause powershell ignore /isfrozen trying display screen?  when /isfrozen working in cmd.exe, displays "frozen" or "thawed" based on state of computer.  has ran similar problem command line utility, switches work , others don't return anything?

any insight or advice appreciated.

tldr: have command line application works in cmd.exe, in powershell, of switches not work.  switch in question returns boolean value.  have tried many different ways command work including variations of invoke-command, start-process, , cmd /c.  have tried produces same result.


i'm not deep freeze user according manual:

dfc /isfrozen

queries computer if frozen. returns error level 0 if thawed. returns 1 if frozen.


if says, result returned through %errorlevel% variable.  in powershell can capture using $lastexitcode variable:

$command = @'     cmd /c "dfc /isfrozen" '@  invoke-expression -command:$command if ($lastexitcode -eq 0) {     'thawed' } else {     'frozen' }

again there no way can test above code.  try , see if works you.




Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group