Remote Command with logged output

BatchPatch Forums Home Forums BatchPatch Support Forum Remote Command with logged output

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8756
    SCT
    Participant

    When i try to execute a remote command i get the Error Message

    Could not find “\HOSTC$Program FilesBatchPatchBatchPatchRemoteProcessOutput1276856335.log”

    The numbers are random.

    My remote command is:

    gwmi win32_logicaldisk | Where DriveType -eq “3” | select Name,@{Name=”SizeGB”;Expression={[math]::Round($_.Size/1GB,2)}},@{Name=”FreeGB”;Expression={[math]::Round($_.Freespace/1GB,2)}},@{Name=’FreePercent’;Expression={[Math]::round((($_.Freespace/$_.Size) * 100))}} | Format-Table -AutoSize

    Is there a maximum length for one command?

    #9974
    doug
    Moderator

    The issue you are having is not due to a max length situation. First, please note that powershell commands need to be executed with syntax like this:

    powershell.exe -command "your command here"

    However, in this case for the complex command that you are trying to execute, using the above-mentioned syntax still won’t work. I think this is because the command contains all sorts of characters, and most likely something is causing BP to unsuccessfully interpret the input. BP is not able to execute 100% of commands that can be executed at a cmd prompt. It can handle most but not all.

    That said, I would suggest two possible alternatives:

    1. The following built-in menu item produces a very similar output to your command: ‘Actions > Get info > Get disk space (available MB) > All disks’

    2. Your command can be saved in a FreeDiskSpace.ps1 file and then run in BatchPatch using the BatchPatch ‘Deployment’ feature. Just make sure to check the box in the ‘Deployment’ window to ‘Retrieve console output’. Then when you execute the deployment BP will copy the FreeDiskSpace.ps1 file to the target computer for execution. This avoids any interpretation/parsing problems. You can save the deployment for future use so that it’s available as a single click of a menu item.

    #9975
    SCT
    Participant

    Thank you a lot!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.