0

This is the powershell command which works fine under windows powershell cli.

Get-ChildItem -Path c:\backup -Recurse | 
     Where-Object {$_.length -gt 1GB} | 
        Sort-Object -Property Length |
            Format-Table  Name,@{name='Size GB';expression={$_.length/1GB}; FormatString='N2'} 

Is there any way I can execute this command using from linux like using WINEXE? howto wrap it?

winexe -U DC/ID%"PASSWORD" //10.0.0.1 'powershell.exe -command "Get-ChildItem -Path c:\backup -Recurse | Where-Object {$_.length -gt 1GB} |  Sort-Object -Property Length | Format-Table  Name,@{name='Size GB';expression={$_.length/1GB}"'
Cœur
  • 37,241
  • 25
  • 195
  • 267
Syed Jahanzaib
  • 333
  • 6
  • 18
  • 1
    [How to escape single-quotes within single-quoted strings?](//stackoverflow.com/a/16605140) ? – wOxxOm Feb 18 '17 at 12:17
  • Thanks Following worked ** '"'"' ** – Syed Jahanzaib Feb 19 '17 at 07:51
  • Full command as follows... ` winexe -U DC/ID%"PASS" //10.0.0.0 'powershell.exe -command "Get-ChildItem -Path c:\backup -Recurse | Where-Object {$_.length -gt 1KB} | Sort-Object -Property Length | Format-Table Name,@{name='"'"'Size KB'"'"';expression={$_.length/1KB};FormatString='"'"'N2'"'"'}"' ` – Syed Jahanzaib Feb 19 '17 at 07:57

0 Answers0