title: Store output value in variable and do arithmetic operation in powershell
body: <p>I am doing  powershell script for getting memory value of some process in powershell also i need to divide the value by 1024 in order to convert KB/MB. </p>
  
  <p>For example </p>
  
  <blockquote>
    <p>PS >>$memory = Get-Process nginx | Select-Object WS | format-wide -Column 1 </p>
    
    <p>PS >>$memory   </p>
    
    <p>62541824</p>
  </blockquote>
  
  <p>This value is in bytes. I need to convert this value into KB/MB. so I performed div operation after that.</p>
  
  <blockquote>
    <p>PS >> $memory = $memory / 1024</p>
  </blockquote>
  
  <p>Method invocation failed because [System.Object[]] doesn't contain a method named 'op_Division'.</p>
  
  <blockquote>
    <p>At C:\script\tomcat-mem.ps1:3 char:13
    + $mem= $mem / &lt;&lt;&lt;&lt;  1024
        + CategoryInfo          : InvalidOperation: (op_Division:String) [], RuntimeException
        + FullyQualifiedErrorId : MethodNotFound</p>
  </blockquote>
  
  <p>Any one help me to resolve this error.</p>