category : Powershell

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 ..

Read more

Ever wanted to track some messages in Exchange ? Here is a neet trick to will help you track messages quickly. A lot more options are available, of course, this is only a small one liner to verify if a user received an email, from someone, on a particular date. Get-MessageTrackingLog -Sender “my.sender@mydomain.com” -Recipients “my.recepient@mydomain.com” ..

Read more

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 ! ..

Read more

Fireup your PowerShell ISE, modify to your needs, and run ! Please leave comments, suggestions below ! Import-Module ActiveDirectory # Determine the base OU $Path = ‘OU=Accounting,OU=-Department,OU=Office,DC=MyDomain,DC=net’ # Determine the new path where the groups will be created. Can be different or the same. $NewPath = ‘OU=HR,OU=-Department,OU=Office,DC=MyDomain,DC=net’ # Get all security groups to duplicate. You ..

Read more

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 Alternative; $Path = ‘\\servername\folder’ Get-ChildItem -Path $Path -Recurse | Remove-Item -Force -Recurse More on the Remove-Item Powershell cmdlet can be ..

Read more