Browsed by
Month: November 2016

Sort files by extension with total size

Sort files by extension with total size

For several reasons, it could be awesome to sort a folder and sub by extension, with the associated size for each.

 

$results=Get-ChildItem -Path "y:\" -Recurse |
#Get only files
Where-Object { !$_.PSIsContainer } |
#Group by extension
Group-Object Extension |
#Get data
Select-Object @{n="Extension";e={$_.Name -replace '^\.'}}, @{n="Size (MB)";e={[math]::Round((($_.Group | Measure-Object Length -Sum).Sum / 1MB), 2)}}, Count
$results |Sort-Object "Size (MB)"|Export-csv "$WorkingDir\Results\$ResultFile" -NoTypeInformation

 

Get all pst files set up in Outlook ?

Get all pst files set up in Outlook ?

Function GetPstFromProfil {
$PSTFiles=$null
$ol=New-Object -ComObject Outlook.Application
$ns=$ol.GetNamespace('MAPI')
$store=$ns.Session.Stores|Where-Object{$_.FilePath -match "pst$"}
$store | Foreach-Object{
	$pst=$_.FilePath
	If($PSTFiles -ne $null){
		$PSTFiles+="|$pst"
	}
	If($PSTFiles -eq $null){
		$PSTFiles=$pst
	}
}

$PSTFiles=$PSTFiles.split("|")

return $PSTFiles
}

Then you just have to call that function such as :

$pstfiles=GetPstFromProfil

How to whitelist website on AdBlocker?

How to whitelist website on AdBlocker?

  1. 1 Click on the AdBlock Plus icon on the top right corner of your browser
  2. 2 Click on "Enabled on this site" from the AdBlock Plus option
  3. 3 Refresh the page and start browsing the site