How do I convert bytes into mb?
How do I convert bytes into mb?
In my piped command I want the bytes to be displayed as megabytes. My command queries a list of computers and returns their physical memory.
How do I do the conversion and where do I add it?
$comp = Get-Content c:usersjasonbecomputerlist2.txt
Get-WmiObject -Class Win32_ComputerSystem -computer $comp | select Name, Totalphysicalmemory |`Export-Csv c:usersjasonbePhysical_Mem.csv`
1 Answer
1
$comp = Get-Content c:usersjasonbecomputerlist2.txt
Get-WmiObject -Class Win32_ComputerSystem -computer $comp |
select Name, @{label="Totalphysicalmemory";expression={[int]($_.totalphysicalmemory/1mb)}}|
`Export-Csv c:usersjasonbePhysical_Mem.csv`
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.