Get the memory usage of a process, grouped, so you get the total. Example; chrome, always have one process per page, use this to get the total of memory used by all of them.
$Processes = get-process chrome,iexplore | Group-Object -Property ProcessName
foreach($Process in $Processes)
$Obj = New-Object psobject
$Obj | Add-Member -MemberType NoteProperty -Name Name -Value $Process.Name
$Obj | Add-Member -MemberType NoteProperty -Name Memory -Value ([decimal]::round((($Process.Group|Measure-Object WorkingSet -Sum).Sum)/1024/1024))
From Laurent’s comments below, another take on this with the following code, which lists all open processes, with total memory:…
Powerful one liner to send an email with PowerShell. Useful in scheduled tasks to send status, or additional info. The use of environment variables is totally optional, but make a fine subject line when you want to know from which server it came from ! Suggestions on improvements are welcome, please leave a comment !…
This script will delte everyting in the “Script” folder, sub-folder, and the “-recurse” option will prevent the prompting of confirmation. The “-exclude” option alllows you to exclude files and folders.
Remove-Item c:\scripts\* -recurse -exclude *.wav
$Path = '\\servername\folder'
Get-ChildItem -Path $Path -Recurse | Remove-Item -Force -Recurse
More on the Remove-Item Powershell cmdlet can be found here: Powershell 1.0 http://technet.microsoft.com/en-us/library/ee176938.aspx Powershell 4.0 http://technet.microsoft.com/en-us/library/hh849765.aspx