Hyper-V get VM VHD Used and Provisioned Storage

Open Powershell as admin   Get-VM | ForEach { $Vm = $_; $_.HardDrives } | ForEach { $GetVhd = Get-VHD -Path $_.Path [pscustomobject]@{ Vm = $Vm.Name Name = $_.Name Type = $GetVhd.VhdType ProvisionedGB = ($GetVhd.Size / 1GB) CommittedGB = ($GetVhd.FileSize / 1GB) } } | Export-Csv -Delimiter ";" -Path "C:\temp\VMVHDStorageUsedTotal.csv"   Creates CSV with data in one column, select column in excel, go to data tab, then text to columns > Delimiter > Semicolon Excel file would look like this: Vm Name Type ProvisionedGB CommittedGB GW1 Hard Drive on IDE controller number 0 at location 0 Dynamic 60 45.12890625 GW2 Hard Drive on SCSI controller number 0 at location 0 Dynamic 40 28.97265625 ...
Read More

Office 365 – check which mailboxes a particular user has access to

Connect to 365 via powershell $UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session -DisableNameChecking.   Get-Mailbox | Get-MailboxPermission -User userA UserA would be the user that you want to know for instance; What mailboxes does Matt have access to would be as follows: Get-Mailbox | Get-MailboxPermission -User matt  ...
Read More

Search Exchange mailbox for a particular folder

Connect to 365 via powershell $UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session -DisableNameChecking. Get-MailboxFolderstatistics -Identity mailboxname | Where {$_.Name -Match "foldername"} For instance to search my mailbox name Matt for a folder that contains alerts the command looks like this: PS C:\WINDOWS\system32> Get-MailboxFolderstatistics -Identity matt | Where {$_.Name -Match "alerts"} Although this give the output below, If you have multiple folders that contain your search criteria it can be difficulty to read To get a better idea of where the folder is located use the identity to filter PS C:\WINDOWS\system32> Get-MailboxFolderstatistics -Identity matt | Where {$_.Name -Match "alerts"} | select identity Identity -------- matt\LanSweeperAlerts Another example is a folder called backups that is within my inbox folder PS C:\WINDOWS\system32> Get-MailboxFolderstatistics -Identity matt | Where {$_.Name -Match "backups"} | select identity Identity -------- matt\Inbox\Backups Once you have finished disconnect your exchange powershell session Remove-PSSession $Session...
Read More